cancel
Showing results for 
Search instead for 
Did you mean: 

STM32l073 IAP

Tobias Witte
Associate II
Posted on May 07, 2018 at 13:31

Hello all,

I want to use the IAP possibility off my Nucleo-STM32L073RZ. I read the AN4657 and downloaded the X-CUBE-IAP-USART folder. I thinck I have an generell problem of understanding the iap. I have a little programm for my Nucleo for using USART and the push buttons. How can I add the iap possibility to my projekt that after a reset the menu will be shown in the terminal program? Maybe you can help me to get a better understanding of this?

Regards

Tobias

1 ACCEPTED SOLUTION

Accepted Solutions
Posted on May 14, 2018 at 17:52

The image you show here is for code that was clearly NOT linked for an 0x08004000 basis (see linker script, scatter file, ie .LD, .SCT, or .ICP)

The ResetHander is marked as being at 0x08000345 which is below the 0x08004000 threshold.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

6 REPLIES 6
Posted on May 07, 2018 at 14:37

Can you use the USART in other situations?

Review the example code for the EVAL board and port to the NUCLEO by addressing any differences in pins or USART/LPUART in use. Use a merge tool to pull across code

STM32Cube_FW_L0_V1.10.0\Projects\STM32L073Z_EVAL\Applications\IAP

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Tobias Witte
Associate II
Posted on May 08, 2018 at 14:33

Hello Clive One,

thanks for your reply. I found the STM32L073Z_EVAL IAP-Projekt and after some fixes it runs on my Nucleo Board. I use Tera Term for the communication and to load the new pgram. The menu starts stable every time. But when I wanted to load the .bin filme there are some problems. Sometimes the load bar stops at 8% for a while and after it reaches the 100% nothing happens and the menu crashes. Sometimes the load process gets finished as well and when I press ''3'' for executing the program I only see the start program string (see attached picture) and nothing happens. After a reset in this state the old program runs on the Nucleo. Seems linke the erase function doesnt work or maybe works on the wrong addres. Can somebody help me how ich can check the adress of the flash for erase und write? Or tell me what I am doing wrong?

Regards

Tobias

0690X0000060B4XQAU.png
Posted on May 09, 2018 at 15:03

 ,

 ,

Hello all,

I used the stm32 st-link utility tool to analyse the flash and set the , ♯ define APPLICATION_ADDRESS to  , , (uint32_t)0x08004000. I put a call of the erase funktion at the beginning auf the download image funktion, so that the flash gets resetet before I upload the image.

 ,

void SerialDownload(void)

 ,

{

 ,

 , FLASH_If_Erase(((uint32_t)0x08004000)),

Here is a screenshot of the rigster values after I send a ''1'' for download image and before I send it via ymodem.

0690X0000060B6EQAU.png

As you can see, all registers are cleared. Then I loaded the .bin file via ymodem und analysed the registers again:

0690X0000060B7vQAE.png

As you can see, uploading of the image works and the code beginns at 0x08004000. The .bin file consist a small projekt were I toggle the led. But it doesnt work when I press ''3'' for execute the loaded application. I looked in the menu.c and this is the code which runs by pressing 3:

 , , , case '3' :

 ,

 , , , , , Serial_PutString((uint8_t *)''Start program execution......\r\n\n''),

 ,

 , , , , , /* execute the new program */

 ,

 , , , , , JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4),

 ,

 , , , , , /* Jump to user application */

 ,

 , , , , , JumpToApplication = (pFunction) JumpAddress,

 ,

 , , , , , /* Initialize user application's Stack Pointer */

 ,

 , , , , , __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS),

 ,

 , , , , , JumpToApplication(),

 ,

 , , , , , break,

Maybe someone has an idea what I am doing wrong and why the uploaded program doesnt work?

Regards

Tobias

Tobias Witte
Associate II
Posted on May 14, 2018 at 16:04

Hallo all,

I tested to set the APPLICATION_ADDRESS  to (uint32_t)0x08000000 so the IAP-code jumps with JumpToApplication(); to itself and this works. So I can write a new program to APPLICATION_ADDRESS (see post above) and the Jump function works. There musst be a little mistake left. I gues there is something wrong when I set the jumpaddress, here is the code for that:

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

      JumpToApplication = (pFunction) JumpAddress;

     /* Initialize user application's Stack Pointer */

      __set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);

when I analyse this in debug session, I can see that the value of the jump address:

0690X0000060KdWQAU.png

but when I have a look at this value I can see that 0x08000D7D doesnt exist as a address:

0690X0000060KlsQAE.png

Isnt there someone who can give me a little tip or something where I have to look to find the mistake?

Regards

Tobias

Posted on May 14, 2018 at 17:52

The image you show here is for code that was clearly NOT linked for an 0x08004000 basis (see linker script, scatter file, ie .LD, .SCT, or .ICP)

The ResetHander is marked as being at 0x08000345 which is below the 0x08004000 threshold.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 15, 2018 at 08:30

Hello Clive One,

you are right. I had to change the __ICFEDIT_intvec_start__ = 0x08004000; in the .icf and now everything works. Thank you really much for your support.

Regards

Tobias