This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

app.hex was loaded in bootloader area when using KEIL compiling.

Hey experts,

We encountered a problem about project porting and using KEIL compiling. 

Here are detailed:

Our products are using gcc+makefile method to compile and generate .hex file, it works fine.
We want to debug product in hardware situation, so we port the project from gcc+makefile to keil.
According to the configuration of makefile and linker file, we added all necessary parameters in options of KEIL.
We didn't change anything of codes. But the startup file was replaced with arm_startup_nrf52.s, not gcc_startup_nrf52.S.

The process of compiling and linking are successful, .hex file was also generated, it sounds good. 

But when we loaded the .hex file generated by KEIL compiler, the application couldn't work.
We found the application was loaded in bootloader area, althoungh we didn't download any bootloader file to chip.

We checked the .map file, it showed all address information are same with we has set. 

Here are some detail figures to explain what happened:

Options for keil:

the .map file:


Thanks for your answer.

Parents
  • Hi,

    Can you do a flash erase before programming both SoftDevice and Application?

    The fact that the programmer tools says it is the bootloader region may come from a UICR register used for setting the bootloader start address. With full flash erase you also erase the UICR page.

    Regarding the startup files, different toolchains have different startup files, and the change that you see of startup file is expected (and required).

    In any case, porting a project to a different toolchain is often easiest if you start with a new project in the new toolchain, and then include files and include directories, set preprocessor defines and other project settings, memory settings, etc.

    Regards,
    Terje

Reply
  • Hi,

    Can you do a flash erase before programming both SoftDevice and Application?

    The fact that the programmer tools says it is the bootloader region may come from a UICR register used for setting the bootloader start address. With full flash erase you also erase the UICR page.

    Regarding the startup files, different toolchains have different startup files, and the change that you see of startup file is expected (and required).

    In any case, porting a project to a different toolchain is often easiest if you start with a new project in the new toolchain, and then include files and include directories, set preprocessor defines and other project settings, memory settings, etc.

    Regards,
    Terje

Children
Related