STM32f103VET6 Bootloader jump problem.

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32f103VET6 Bootloader jump problem.

Post by Giovanni »

I cannot give advice about this, you have to discover where it goes in exception.

Giovanni
franek.bmw
Posts: 57
Joined: Thu Mar 13, 2014 11:15 am
Has thanked: 2 times

Re: STM32f103VET6 Bootloader jump problem.

Post by franek.bmw »

It goes to exception at the and of this function, in Jump_To_Application();

Code: Select all

void jumpToUser(uint32_t address) {

   typedef void (*pFunction)(void);

   pFunction Jump_To_Application;

   /* variable that will be loaded with the start address of the application */
   vu32* JumpAddress;
   const vu32* ApplicationAddress = (vu32*) address;

   if (((*(unsigned long*)address) & 0x2FFE0000 ) == 0x20000000)
   {



      /* get jump address from application vector table */
      JumpAddress = (vu32*) ApplicationAddress[1];

      /* load this address into function pointer */
      Jump_To_Application = (pFunction) JumpAddress;

      /* Clear pending interrupts just to be on the safe side*/
      SCB_ICSR = ICSR_PENDSVCLR;

      /* Disable all interrupts */
      uint8_t i;
      for(i=0; i<8; i++)
         NVIC->ICER[i] = NVIC->IABR[i];

      /* set stack pointer as in application's vector table */
      __set_MSP((u32) (ApplicationAddress[0]));
      Jump_To_Application();
   }
}
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32f103VET6 Bootloader jump problem.

Post by Giovanni »

Try to single step instruction by instruction. There must be one that causes the crash.

Giovanni
franek.bmw
Posts: 57
Joined: Thu Mar 13, 2014 11:15 am
Has thanked: 2 times

Re: STM32f103VET6 Bootloader jump problem.

Post by franek.bmw »

I found bug! :-) In my app I make in RAM fifo which overflow memory. When I reduce size of fifo all is good.
So I have a question. Probably when processor jump from bootloader to app in RAM remain some unnecessarily variables. It is possible to release this area of RAM?


BTW: If my application was written in CHIBIOS, I would have found this problem much earlier. But when I wrote it, I did not know yet CHIBIOS ;-)
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32f103VET6 Bootloader jump problem.

Post by Giovanni »

When you jump to the application the bootloader is no more active (I assume), you can use all the RAM.

Giovanni
franek.bmw
Posts: 57
Joined: Thu Mar 13, 2014 11:15 am
Has thanked: 2 times

Re: STM32f103VET6 Bootloader jump problem.

Post by franek.bmw »

So what can caused this lack of memory?

Franek
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32f103VET6 Bootloader jump problem.

Post by Giovanni »

Sorry, I don't understand...
franek.bmw
Posts: 57
Joined: Thu Mar 13, 2014 11:15 am
Has thanked: 2 times

Re: STM32f103VET6 Bootloader jump problem.

Post by franek.bmw »

When I have only app, my fifo size could be 500B, when I have bootloader too, my fifo in app could be only 120B. Why?
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32f103VET6 Bootloader jump problem.

Post by Giovanni »

You are asking me things specific to your setup, how I am supposed to answer?

I can only recommend to study the map files in order to understand the memory organization of your application, then eventually evaluate changes to the .ld scripts.

Giovanni
franek.bmw
Posts: 57
Joined: Thu Mar 13, 2014 11:15 am
Has thanked: 2 times

Re: STM32f103VET6 Bootloader jump problem.

Post by franek.bmw »

Could you give me some clue, if I send to you my linker script or map files?
Post Reply