[HELP WANTED] Linker script in case of loading from memory.
Arch: cortex_m7 Toolchain: GNU
Hi, I have general question regarding linker script. If the module is fetched in a dynamic memory from a file system, how can I identify the starting address for FLASH or RAM to write in my linker script?
You can use any address you want for the linker script. For example, here we use 0x00030000.
@goldscott Thanks for the response. About the regions, I guess I can only use one or both FLASH and RAM would be required?
@zq649 you can execute a module from flash or RAM. It's up to you to determine where to place it. If you are going to read a module from a file and flash it, you would need to implement the code necessary to write to your chip's flash. Then you should call txm_module_manager_in_place_load. If you want to execute from RAM, you can simply call txm_module_manager_file_load and it will read the module from the file and place the module in RAM
@goldscott as for the ARMCC --first option is used to place the preamble at start of the execution region. What is the alternative for GCC?
I am using the this linker script but the preamble is being placed at 0x000301d0.
@qasim-ublox ah, you need to add ".section .preamble" to the preamble assembly file like is done here: https://github.com/azure-rtos/threadx/blob/master/ports_module/cortex_m0%2B/gnu/example_build/sample_threadx_module/txm_module_preamble.S#L4
@goldscott thanks. Any specific reason that this line is not added in preamble file for cortexm7?
@qasim-ublox I think it was just forgotten in the M3/M4/M7 ports. I'll make a note to add it for our next release.
@goldscott this line and the line above is also not added for M7. What is the reason for + 0x80?
@qasim-ublox 0x80 is the length of the preamble in bytes.
@qasim-ublox, we have a module(cm7,gcc) project here https://github.com/wangwen-4220/stm32f746-disco-module/blob/main/stm32cubeide/sample_threadx_module/cm7/sample_threadx_module.ld
we have done some fix about the sample_threadx_module.ld and txm_module_preamble.S.
please let us know if it is helpful and we can close the issue.