This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Custom bootloader and app relocation problem

Hi,

i am trying to make a custom ethernet bootloader for an STM32F207 based board (full ref STM32F207IG eval), so this is going to happen in 3 steps.

1/ relocate the main program at address 0x08008000
2/ have a bootloader jump there
3/ add the ethernet support (lwip)

I am using eclipse / gcc toolchain; i have built the main app, that works fine, and i flash it using the command "ST_link_CLI.exe -C JTAG -Q -P myapp.bin 0x08000000"

But now i have to add the bootloader. Every time i try to relocate the app to 0x8008000 i cant make it work. As a test, the first thing i do after board init in the main program is setting a led on, and it never lits.

I tried every combination of these:

change the command "ST_link_CLI.exe -C JTAG -Q -P myapp.bin 0x08008000"

change from
GL_NVIC_SetVectorTable(GL_NVIC_VectTab_FLASH, 0x00)
to GL_NVIC_SetVectorTable(GL_NVIC_VectTab_FLASH, 0x08000).
or to GL_NVIC_SetVectorTable(GL_NVIC_VectTab_FLASH, 0x08008000).

changing

#define NVIC_VectTab_FLASH           ((uint32_t)0x08000000)
to #define NVIC_VectTab_FLASH           ((uint32_t)0x08008000)


and in stm32_ld.S file, MEMORY :

FLASH (rx)      : ORIGIN = 0x08000000, LENGTH = 1024K
to
FLASH (rx)      : ORIGIN = 0x08008000, LENGTH = 1016K

Whatever i do, that led does not lit.

Here is the code used to jump, with APPLICATIONADDRESS being 0x08008000 :

      /* Jump to user application */
      JumpAddress = *(__IO uint32_t*) (APPLICATIONADDRESS + 4);
      Jump_To_Application = (pFunction) JumpAddress;
      /* Initialize user application's Stack Pointer */
      __set_MSP(*(__IO uint32_t*) APPLICATIONADDRESS);
      Jump_To_Application();
   }
  while (1)
  {}

I also saw that someone named Marco Accame posted on this bbs, long time ago though, and mentionned he did an ethernet bootloader. I would really like his advice on this and the next step if he is still around.

thanks a lot everyone !

Parents
  • This is a Keil forum rather than a GNU/GCC one.

    Does the .MAP file and .LST/LSS listing file suggest the code is where you want it to be?

    Can you use a debugger? No, seriously, step the transition code and understand what is actually going on, it's what the professionals do.

    STM32F2 Ethernet IAP (In-Application Programming) w/LwIP
    www.st.com/.../PF257895

    Project templates for Keil should be in there

Reply
  • This is a Keil forum rather than a GNU/GCC one.

    Does the .MAP file and .LST/LSS listing file suggest the code is where you want it to be?

    Can you use a debugger? No, seriously, step the transition code and understand what is actually going on, it's what the professionals do.

    STM32F2 Ethernet IAP (In-Application Programming) w/LwIP
    www.st.com/.../PF257895

    Project templates for Keil should be in there

Children
  • Hi, thanks for the link. I thought this was also a forum for keil based board. I did not think htis was a compiler or framework related error though.

    So, bit of an update.

    We figured out how to make it work from anywhere ( i am not familiar with eclipse at all, it looks like it would not account for mods on .s and .ld files unless the project was cleaned ).

    in the end we needed to set these :

    FLASH (rx)      : ORIGIN = 0x08008000, LENGTH = 1016K
    #define NVIC_VectTab_FLASH           ((uint32_t)0x08008000)
    

    Now we flashed both the "bootloader" (that just jumps to the main app) and the main app, and we just dont seem to jump at the right place, the bloody startup led does not lit.

    it looks like there is data on both zones of the flash, so i am going to get the debugger out and see what is actually happening. I think i won't be able to see anything pas the jump() though :/