Is it possible to use a label, which is inside one PIO asm program, in another PIO program, more specifically, as an offset in the .origin directive?
The use case is this: I have a long program that starts from address 0 and ends at address 22 and then follows some free space and then the program continues again from address 26 to the end of PIO instruction memory, from where it loops back to address 0 (as intended). I *might* need to place another, smaller program in the empty space at address 22-25. To do the loading I used a custom function that overwrites the unused part of the first program with the second one. So far, I specify the address to place the second program manually, using '.origin 22', but I thought it would be more automated to just take a label from inside the first prog and use that in the .origin of the second one (because while editing the first program, the position of the second one inside it might move).
And yes, I can just use the second program's code from the first program and execute it without loading to PIO mem (using pio asm lables access from C code that works fine), but then I'd have to set the .wrap manually then (which is used in the second program).
The use case is this: I have a long program that starts from address 0 and ends at address 22 and then follows some free space and then the program continues again from address 26 to the end of PIO instruction memory, from where it loops back to address 0 (as intended). I *might* need to place another, smaller program in the empty space at address 22-25. To do the loading I used a custom function that overwrites the unused part of the first program with the second one. So far, I specify the address to place the second program manually, using '.origin 22', but I thought it would be more automated to just take a label from inside the first prog and use that in the .origin of the second one (because while editing the first program, the position of the second one inside it might move).
And yes, I can just use the second program's code from the first program and execute it without loading to PIO mem (using pio asm lables access from C code that works fine), but then I'd have to set the .wrap manually then (which is used in the second program).
Statistics: Posted by wisi — Sat Jun 07, 2025 1:47 pm