Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMXRT: update linker scripts so that the code section does *not* star… #2553

Conversation

ccrome
Copy link
Contributor

@ccrome ccrome commented Mar 28, 2024

IMXRT: update linker scripts so that the code section does not start at 0x0.

Describe the PR
On those cpus that have the internal RAM start at 0x0, this sets the start of ram to 0x20, so that we can never end up with a valid piece of code living at address 0x0. That's a bad thing.

Additional context
This happens when you put stuff into CodeQuickAccess memory.

all of these linker scripts are directly from the mcu directory. The downside is that if the upstream mcu release changes, it may be necessary to update these linker_scripts files

…t at 0x0.

On those cpus that have the internal RAM start at 0x0, this sets the start of ram to 0x20, so that we can never end up with a
valid piece of code living at address 0x0.  That's a bad thing.
@hathach
Copy link
Owner

hathach commented Mar 29, 2024

I still don't understand why we need to make this change, can you elaborate it please. Please note that these linkers are only used by tinyusb examples only.

@ccrome
Copy link
Contributor Author

ccrome commented Mar 29, 2024

Totally true. I just got burned when I ended up with a function pointer at address 0x0.

Then when I did the callback thing:

if (funcptr)
funcptr()

funcptr was placed at 0x0 and never got called.

Not an issue for the examples since they don't place anything in fast ram. But when taking the examples and building off of them, it could be an issue.

It's totally fine to close this if not worthwhile.

@hathach
Copy link
Owner

hathach commented Mar 29, 2024

function callback at address 0x0 is kind of odd, though totally valid. Normaly that is for reset/entry/start. However, within the scope of tinyusb examples, we don't really need it and I really don't want to maintain these linker script if I don't have to. Thank you.

Note: in the future I will try to migrate from weak callback to weak/ref default implementation. It will elimiate the need for the if (func_cb) func_cb(), this is for keil compatible see #1018

@hathach hathach closed this Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants