1 Reply Latest reply on Sep 20, 2019 5:45 AM by WeWh_3706036

    STM32 WAF Bootloader

    WeWh_3706036

      We are trying to separate the bootloader from the application.  However, it seems the application code and bootloader are consistently built together.  I was wondering what the correct setting in either the platform makefile or WICED/MCU/STM32/makefile is the correct define to force it to build only the application? Since we need to do our own custom OTA I would like to make use of waf_bootloader and have it exist on the device much like the ota bootloader and be able to launch the application.  I have hard coded the entry_point into bootloader.c  and programmed the code up at the address desired -- but it does not boot.  To be absolutely clear I:

       

      1. Built the application

      2. Dumped the elf header to get the entry point (entry_point fro elf header is : 0x8007580

      3. Programmed my application at the desired location (used in the linker) (0x08007000)

      4. Rebuilt the waf with platform_start_app(0x8007580) // using the entry point

      5.  Flashed the bootloader at (0x08000000)

      6. reset the board -- nothing  failure to boot

      7.  If I program the application both at  (0x08000000) and  (0x08007000) -- works like a charm

      8.  Reviewing the map file of both the app and waf -- the both contain the same at the lowest part of the address -- so basically by programming the app at 0x8000 it looks like the same exact code as the WAF -- but no boot.

      -- yes I have looked at the linker file (attached)

       

      Any help would be greatly appreciated -- What I want is to separate the app from the bootloader -- so I can just update the application.  Not sure where I am going wrong.

        • 1. Re: STM32 WAF Bootloader
          WeWh_3706036

          I will answer my own question in case it helps someone else:
          -- vector table of the application firmware needs to be relocated before jumping to the bootloader-- I mistakenly thought this was being taken care of in the WAF. 
          -- disable RCC
          ------------------SNIP---------------------

          platform_start_app()

          {

          uint32_t  JumpAddress = *(__IO uint32_t*)(APP_CODE_START_ADDR + 4);

              pFunction Jump = (pFunction)JumpAddress;

             

              HAL_RCC_DeInit();

              HAL_DeInit();

             

              SysTick->CTRL = 0;

              SysTick->LOAD = 0;

              SysTick->VAL  = 0;

             

           

           

              SCB->VTOR = APP_CODE_START_ADDR;

           

           

             

              __set_MSP(*(__IO uint32_t*)APP_CODE_START_ADDR);

              Jump();

          }