cancel
Showing results for 
Search instead for 
Did you mean: 

Custom User application unable to start after SFSFU completion (Solved)

Hi.. Geeks

From few days I'm playing with SBSFU.

I'm using default application SBSFU files (STM32L496G-Discovery_AWS) with custom user application with STM32L496ZG

The default code was ported on STM32L496AG which is x-cube AWS

I have simply adopted it's default BootloaderOSC files

To get synchronized with the original application, I have been change linker script of the user application as per the default app

As per the default app,I've been linked out all applications with SBSFU script file and I'm able to generate the .sfb files

Now my problem is, when I upload the .sfb file using teraterm YMODEM then SBSU files starts executing and I'm getting logs accordingly

here is the logs

======================================================================
=              (C) COPYRIGHT 2017 STMicroelectronics                 =
=                                                                    =
=              Secure Boot and Secure Firmware Update                =
======================================================================
 
 
= [SBOOT] SECURE ENGINE INITIALIZATION SUCCESSFUL
= [SBOOT] STATE: CHECK STATUS ON RESET
          INFO: A Reboot has been triggered by a Software reset!
          Consecutive Boot on error counter = 0
          INFO: Last execution detected error was:No error. Success.
= [SBOOT] STATE: CHECK NEW FIRMWARE TO DOWNLOAD
= [SBOOT] STATE: CHECK USER FW STATUS
          A valid FW is installed in the active slot - version: 1
= [SBOOT] STATE: VERIFY USER FW SIGNATURE
= [SBOOT] STATE: EXECUTE USER FIRMWARE
Jump Address: @ 8084b21
Set StackPointor: @8084b21

You can see, my application going to jump on 0x8084b21, but some how my main application won't execute!

More over after reading few thread, I also have changed my vector table at system_stm32l4xx.c file as follows

 
 
#if defined(__CC_ARM)
#undef __GNUC__
#endif
#if defined(__ICCARM__)||defined(__GNUC__)
extern uint32_t __ICFEDIT_intvec_start__;
#define INTVECT_START ((uint32_t)& __ICFEDIT_intvec_start__)
#elif defined(__CC_ARM)
extern uint32_t Image$$vector_start$$Base;
#define INTVECT_START ((uint32_t)& Image$$vector_start$$Base)
#endif
 
 
 
  void SystemInit(void)
  {
 
.
.
.
 
/* Configure the Vector Table location add offset address ------------------*/
    SCB->VTOR = INTVECT_START;
 
}

Can anyone help me here?

All suggestions and comments welcome =)

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Hello Mahendra,

Ok this is a know issue that will be fixed on next release of SBSFU.

The problem is that systick is not stopped before jumping to application.

The interrupt raises when RTOS has not initialized yet its timer queues.

So, you need to simply deactivate systick interrupt in SBSFU just before the jump.

There are other post on this issue.

Best regards

Jocelyn

View solution in original post

6 REPLIES 6
pragnesh
Associate III

hello 

i have same issue 

have you found any solution ??

Jocelyn RICARD
ST Employee

Hello Mahendra,

I would try following things

1) Start from clean flash, launch your application with debugger, and see if it is starting

2) Deactivate all protections on SBSFU and rebuild SBSFU and user app. Flash SBSFU_UserApp.bin. Start debugger on SBSFU and break before the launch of the application. Then go step by step in instruction mode and see where it is going. If it seems to jump on the reset vector, then step 3

3) Launch debugger on user application (no download) and put a breakpoint on reset handler (located in startup_*.s file, Then execute and press reset. The SBSFU will execute and launch the application. You should stop on the reset handler and then see with debugger what's happening

With this steps, you should find the reason why user application is not starting

Best regards

Jocelyn

Hi... @Jocelyn RICARD​ Sir..

Thanks for your kind reply

I have already performed first 2 steps and that's seems working for me

Now for the 3rd step, as per your suggestion, I've set the breakpoints at reset vector at  startup_*.s and then press reset

The good news is, SBSFU run first and it's jumping on the reset vector and then after my user application !

But after some execution, my user application causes the hardfault!

The reason is SysTick Or System clock config as i guess

because in SBSFU, systick is used for the synchronization, where as my user application run on FreeRTOS having TIM2 as Systick source

Probably the second reason is, SBSFU run with the MSI as core clock where as in my application I've used HSE as core clock and LSE for the RTC clock

When i set the hardfault analyzer for the then i got to know the hardfault is because of "Precise Data access violation"

0693W000003Bc0cQAC.jpg

The program counter is stuck at void xPortSysTickHandler( void ) of FreeRTOS !

Any recommendations ?

Thanks

Hello Mahendra,

Ok this is a know issue that will be fixed on next release of SBSFU.

The problem is that systick is not stopped before jumping to application.

The interrupt raises when RTOS has not initialized yet its timer queues.

So, you need to simply deactivate systick interrupt in SBSFU just before the jump.

There are other post on this issue.

Best regards

Jocelyn

Hi.. @Jocelyn RICARD​ Sir..

The issue has been solved by disabling the Systick

Thanks a lot Sir.. :face_with_steam_from_nose:

Hi,

do you already have a release date for the next SBSFU version 2.4.0?

A few weeks ago I was told that it would be released by end of July.

Thanks.