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

Bootloader with RTX does not work on STM32F103ZE

Hello,

I have a bootloader and a sample application that simply lights two LEDs in the STM32F103ZE board. The bootloader sits at 0x0800-0000 and the application sits at 0x0800-2000. The related bootloader macros are:

#define MAIN_APP_START           0x08002000UL
#define MAIN_APP_IRQ             0x08002100UL
#define MAIN_APP_END             0x08020000UL

When the bootloader starts, it initializes CAN, J1939 and NVIC. In the nvic_init() of the bootloader, vector table offset is set as follows:

/* set the vector table offset */
  NVIC_SetVectorTable(NVIC_VectTab_FLASH, (uint32_t)&__Vectors);

After the initilization is done, the bootloader then checks the application header for the valid checksum, then gets the address of the entry point, and jumps there. The code is as follows:

  /* interrupts must be disabled since they won't be setup in app space yet */
  __SETPRIMASK();

  /* get address of entry point function */
  entry=(void(*)(void))(*((uint32_t volatile*)(MAIN_APP_IRQ+4)));

  /* load CPU's vector offset register with the new location */
  NVIC_VTBL = MAIN_APP_IRQ;

  /* jump to entry point */
  entry();

The application then starts and initializes CAN, J1939 and NVIC. In the nvic_init() of the application, vector table offset is set as follows:

/* set the vector table offset */
  NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x2100);

After the initilization is done, the applicaton then simply lights 2 LEDs in the board.

This works without any issue.

However, when I want to do the application work inside RTX, it does not work. It gets into some sort of infinite loop (in the assembly code) while calling os_sys_init() to start the RTX kernel.

What am I missing?

Any help would be greatly appreciated, as it is a workstopper for my work. If I need to provide any further information from my side, let me know.

Thanks in advance,

Nilanjan