-
Notifications
You must be signed in to change notification settings - Fork 109
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
fix nrf52 layout #98
fix nrf52 layout #98
Conversation
It looks like the application start address on nRF52 has moved upwards by 64kB since the library was tested the last time.
Since you mentioned the I don't have an "nRF52-DK" board to test on, but maybe there needs to be two different layouts, i.e. |
I can't see any fundamental difference between the two boards when deploying libtock-c applications. libtock-rs applications work fine with the new layout on the nRK52-DK and immediately hardfault on an nrf52840-DK. Nothing happens on both boards with the old layout (not surprisingly, the nRF52840-DK always had the program origin at 0x30000, and the nRF52-DK since tock/tock@bf71fff4c). So the layout is correct, for sufficiently small values of "correct", applications shouldn't have to care about board specific layouts except for #28. |
The SRAM is somewhere else on the nRF52840-DK, so it does need it's own layout file after all while relocation doesn't work. |
As far as I understand, there are multiple factors affecting the location of the SRAM symbol (where the app memory is located in RAM).
One can increase the memory available for an app by increasing the heap size ( This means that there is no one true value for the SRAM, it depends on the application. A long-term way to fix this would be to have relocation working properly, i.e. fixing #28. In the meantime, I guess we can use a "baseline" SRAM value, i.e. the smallest that fits the kernel memory and a simple app (e.g. blink) with the default |
As far as I understand it, the SRAM for the first application will always start a the lowest possible loaction (currently 0x20004000 for the nRF52840), so the value should work for all applications as long as the application is installed as the first application on the board. If you want to install an application written in rust in another position, you will indeed need a custom layout for every combination of apps you have installed before... |
Not exactly. The memory address for each app is computed in The You can check this behavior by increasing the |
OK, so the build script should do the following: build the code, run arm-none-eabi-objdump on the output and check the .data and .bss sizes, if they are larger than 8k generate a new layout, rewrite .cargo/config, and rebuild. Uhhhh... no. But if it is documented, it is no longer a bug, but a feature. |
someone(TM) really should do somting about issue 28.
No, github, "someone should fix" does not mean that it is fixed. |
@fhars what is the state of this PR? Is this is a state to be reviewed and merged from your perspective? |
I tested it and it works. The hardware_tests are green except for "gpio out" which is not working anymore after updating the kernel, so I would not merge. One way to fix this would be to select a working kernel version which is also compatible with the changes in this PR. |
MEMORY { | ||
/* The application region is 64 bytes (0x40) */ | ||
FLASH (rx) : ORIGIN = 0x00030040, LENGTH = 0x000CFFC0 | ||
SRAM (rwx) : ORIGIN = 0x20004000, LENGTH = 62K |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the SRAM length is correct. Isn't there more memory than that on the nRF52840-DK?
I would like to merge this PR very soon. As the nrf52840 has never been supported by |
It looks like the application start address on nRF52 has moved upwards
by 64kB since the library was tested the last time.