It's hard to disagree without being contradictory but I don't see this thread as having gone astray at all; it simply covered additional but related territory.I'm out because this thread got astray just for the sake of contradicting.
I don't see any contradiction, and certainly not just for the sake of it. There is nothing wrong IMO in challenging the suitability or benefits of approach, wanting to see evidence that something is better than something else. I could say much more but I won't.
I would however note the discussion on code generation, how compilers implement access to variables at auto-placed and absolute addresses, was in response to your own "What is this sequence supposed to do ?" question.
Seeing as this thread appears to have covered almost all it needs to, here's a summary of answers to the OP's question as I see it -
Others are welcome to add to that as they feel fit. Those who feel the thread has run its course are free to ignore it.
There are three options for putting variables at absolute addresses when using Pico SDK -
- Using 'section' and having a custom linker script.
- Using '#define' and abstracted pointers.
Each approach has its advantages and disadvantages.
- Using standard 'type var' definitions and 'asm' to set the address.
In addition a packed 'struct' can be used to group multiple variables together at an absolute address. This reduces the number of variables which have to be explicitly placed at absolute addresses and allows the number of 'section' and customisation of linker scripts to be minimised if that approach is used.
The only thing I can see not covered in this thread are examples of how to use 'section' and how to customise a linker script appropriately if wanting to use that approach. I don't know how to do that but I am sure the information is out there and maybe a forum member could provide that information.
Statistics: Posted by hippy — Wed Mar 26, 2025 12:08 pm