Hello ARM Community,We are trying to use Keil with GCC toolchain.Compiling, debugging, all is working well.Except 2 things:- code browsing (not the point of this thread)- flash programmingThe target programming is done using a Segger J-Link.
While in normal Keil config (ARMCC) the integrated J-Link driver handle the programming flawlessly, in GCC context the J-Link driver is less able: the flashing sequence is performed by at the wrong address, thus the flashing is not effective.We have not yet figured where the wrong address comes from: the driver try at 0x08055000 instead of the wanted 0x08008000, in our case.Our current workaround is to flash via the option "Use External Tool" with a bit of JLink Commander scripting, but doing this way is less practical in dev/debug situation because we can't use the automated flash-before-debug option, each step must be done manually.Did someone already solved this kind of situation?Any idea is welcome.Thanks
Yes I agree (it's what I always thought).The ELF/AXF, HEX are generated properly, once flashed debug can be done using the ELF.I surmise it would not be the case if the address on those files were wrong.arm-none-eabi-size --format=sysv --radix=16 and decompiing the ELF both confirm the addresses within the ELF are the good one (0x08008000 in my case).When Keil is flashing there is the blue progress bar in the bottom left corner which indicate the address which is currently worked on.As it quite fast (even more when the programming don't actually do anything) I've made a video capture to see the detail of the progress, and I could see it didn't start at address 0x08008000 as expected, but 0x08055000 instead.I've tried to manually edit the UVPROJX to align some parameters, mainly the <OnChipMemories> section which is slightly different in the ARMCC build target and the GCC build target, but without effects.
arm-none-eabi-size --format=sysv --radix=16
The linker script is a template from the ST device packages, used in their CubeIDE, so I had assumed it was not too bad.In the linker script the memories are defined as the following:MEMORY{FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 0x77FEBRAM (xrw) : ORIGIN = 0x200000C0, LENGTH = 0x17F3F}
MEMORY
{
FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 0x77FEB
RAM (xrw) : ORIGIN = 0x200000C0, LENGTH = 0x17F3F
}
I didn't fill the "Text Start"/"Data Start" fields of the Project option window as it break the build.
Well, then it is difficult to comment further without being able to reproduce this. Can you send the file you try to flash? You can also open a support case for that if you don't want to share this here.