We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,I am trying to create a binary image that can be run from either 0x08010000 of 0x08044000 in a STM32L476 Processor using the Keil MDK-ARM 5.42.0.0 Development environment with the armclang 6.23/6.19/5.06 (Options I have tried) compiler.I am unable to find detailed documention on how to make this work.I have found a trivial project guidelines that does not really include any of the sections needed in the scatter file.here is the trivial example: developer.arm.com/.../Bare-metal-Position-Independent-Executables
However, this is not detailed at all and does not describe what is and what is not supported in Compiler 6.23/6.19/5.06
Here is what I have tried with 6.23:C/C++(AC6) flags: -fbare-metal-pie, Asm flags: -fbare-metal-pie <--- argument ununsed during compilationLinker flags: --bare_metal_pie. When I do this, I see the following linker warnings/errors:
linking....\OBJ\ELSA-16T_Application.axf: Warning: L6083W: Use of the --scatter option with the --pie option is experimental.\OBJ\ELSA-16T_Application.axf: Warning: L6320W: Ignoring --keep command. Cannot find argument '__arm_relocate_pie_'..\OBJ\ELSA-16T_Application.axf: Error: L6218E: Undefined symbol __RW_BASE (referred from startup_stm32l476xx.o)..\OBJ\ELSA-16T_Application.axf: Error: L6218E: Undefined symbol __arm_relocate_pie_ (referred from anon$$obj.o).Not enough information to list image symbols.Not enough information to list load addresses in the image map.
The first warning I am sure was put in for a reason. Use of the --scatter option with the --pie option is experimental. i.e. Your on your own.The undefined symbol __RW_BASE comes from the startup_stm32l476xx.s where I do this: IMPORT __RW_BASELDR R9, =__RW_BASEJust before LDR RO, =__main.
The simple scatter file shown in the example link above does not explain how to put __arm_relocate_pie_ into a scatter file.The next option I tried was also with Compiler 6.23
C/C++(AC6) flags: -fropi -frwpi Asm flags: -fropi -frwpiLinker flags: --ropi --rwpi
I have the linker flags with and without --ropi --rwpi.The only difference is if I get the warnings about --ropi and --rwpi.
linking...
.\OBJ\XXXXX.axf: Warning: L6914W: option ropi ignored when using --scatter.
.\OBJ\XXXXX.axf: Warning: L6914W: option rwpi ignored when using --scatter.
.\OBJ\XXXXX.axf: Error: L6640E: PDTTable section not least static data address, least static data section is .cmis_i2c_table0
Not enough information to list image symbols.Finished: 1 information, 2 warning and 1 error messages.".\OBJ\XXXXX.axf" - 1 Error(s), 64 Warning(s).
I have tried adding an attached pdt_marker.c to get the .r9base sections. With or without the pdt_marker in my scatter file I still get the dreaded error L6640E:
linking....\OBJ\XXXXX.axf: Error: L6640E: PDTTable section not least static data address, least static data section is .cmis_i2c_table0Not enough information to list image symbols.Finished: 1 information, 0 warning and 1 error messages.
".\OBJ\XXXXX.axf" - 1 Error(s), 62 Warning(s).Target not created.
I also tried the same strategies on the armclang version 6.11 and 5.06 with similar results using slightly different arguments.What I would really like is some advice on the best way to make a position independent executable that relocates its vectors to a spot in ram. I have the relocation of the vectors in ram working, I just cannot for the life of me figure out how to get this compiler to use the R9 base ( register R9 ) to make relative jumps and addresses.
Detailed documentation would also be greatly appreciated.Thanks in advance for any help.
Adrian