Skip to main content
peterd
Associate II
April 7, 2021
Question

I want to start the update out of my application as the UserApp does. I have ported the functions but I'm searching for the definition of SlotEndAdd and SlotStartAdd. They are defined as external in sfu_fwimg_regions.h.

  • April 7, 2021
  • 19 replies
  • 3978 views

..

This topic has been closed for replies.

19 replies

Jocelyn RICARD
ST Employee
April 7, 2021

Hello Peter,

I would suggest reusing the fw_update_app.c provided in example application

You can see it is including sfu_fwimg_regions.h which defines these symbols.

Best regards

Jocelyn

peterd
peterdAuthor
Associate II
April 8, 2021

Hello Jocelyn,

I have reused the UserApp code, but these symbols are defined external in sfu_fwimg_regions.h.

I have scanned the UserApp code but I'm blind to find the definition of these symbols. I need a hint.

The se_interface_app.o lib is included.

Best regards,

Peter

Arno1
Senior
April 8, 2021

the definition should be right underneath the extern declarations but one of these has to be defined (see line 81 in sfu_fwimg_regions.h):

#if defined(SFU_FWIMG_COMMON_C) || defined(SE_LOW_LEVEL_C) || defined(TEST_PROTECTIONS_C)

e.g. on line 93:

/* List of slot start address */
const uint32_t SlotStartAdd[NB_SLOTS] = { 0U,
 SLOT_ACTIVE_1_START,
 SLOT_ACTIVE_2_START,
 SLOT_ACTIVE_3_START,
 0U,
 0U,
 0U,
 0U,
 };

where SLOT_ACTIVE_1_START is defined in mapping_export.h

peterd
peterdAuthor
Associate II
April 8, 2021

That's right, but this block is not active in the UserApp.

I can't find the external definition inside the UserApp project.

Also the three switches are not documented.

Jocelyn RICARD
ST Employee
April 8, 2021

Hi Peter,

yes this part is not that well documented.

Now, just searching the defines proposed you will see that TEST_PROTECTIONS_C is defined in test_protection.c in the UserApp example.

So, just add this define in your project on you should be fine

Best regards

Jocelyn

MBax.2
Associate III
January 27, 2022

@Jocelyn RICARD (ST Employee)

Hi Jocelyn,

I am running into a similar problem. I've used the SBSFU UserApp as a base for a new program, and included the same files and copied all project options. My errors are undefined references in my *.o file, for example:

............/src/ota_pal.o:(.rodata.SlotStartAdd+0x4): undefined reference to `__ICFEDIT_SLOT_Active_1_start__'

There are multiple undefined references. The others are:

__ICFEDIT_SLOT_Active_2_start__

__ICFEDIT_SLOT_Active_3_start__

__ICFEDIT_SLOT_Dwl_1_start__

__ICFEDIT_SLOT_Dwl_2_start__

__ICFEDIT_SLOT_Dwl_3_start__

__ICFEDIT_SWAP_start__

__ICFEDIT_SLOT_Active_1_end__

__ICFEDIT_SLOT_Active_2_end__

__ICFEDIT_SLOT_Active_3_end__

__ICFEDIT_SLOT_Dwl_1_end__

__ICFEDIT_SLOT_Dwl_2_end__

__ICFEDIT_SLOT_Dwl_3_end__

__ICFEDIT_SWAP_end__

I can see that these values are present in the UserApp.map file, and are missing in the *.map file of my own application. I do however not know why, as I copied all includes and project setting from the UserApp.

MBax.2
Associate III
January 27, 2022

Found it,

Forgot the add to the linker script (the *.ld file) the following includes:

INCLUDE mapping_fwimg.ld

INCLUDE mapping_sbsfu.ld

Clark Sann
Associate III
April 11, 2022

@Jocelyn RICARD​ 

My application is also unable to locate SlotStartAdd and SlotEndAdd. I can duplicate the exact behavior I am having with UserApp.

  1. Build UserApp normally. It will build. Note that in sfu_fwimg_regions.h, the block starting on line 78 is INACTIVE. In test_protections.c there is the statement on line 21 #define TEST_PROTECTONS_C.
  2. Exclude from build test_protections.c. This will cause multiple undefined references for SlotStartAdd and SlotEndAdd.
  3. Add #define TEST_PROTECTONS_C in main.c. This does not fix the problem.
  4. Remove #define TEST_PROTECTIONS_C from main.c.
  5. Add #define TEST_PROTECTIONS_C on line 77 of sfu_fwimg_regions.h. This makes the following block ACTIVE but causes other errors.
  6. Remove #define TEST_PROTECTIONS_C from sfu_fwimg_regions.h. The app state is now exactly like in step 2 above and it will not build.
  7. Add a new source file test_protections_1.c and put ONLY the following code in that file: #define TEST_PROTECTIONS_C, #include "flash_if.h" and #include "sfu_fwimg_regions.h". The project will now build with this skeleton source file.
  8. Commenting out any or all of these three lines will cause build errors.

I am unable to explain why adding #define TEST_PROTECTIONS_C to main.c does not cause the app to build.

I have the exact same behavior in my app whose settings closely follow the settings for UserApp.

Could you please help me build my app without having to either comment out most of test_protections or adding a file source file containing only the #define and the two #includes?

MBax.2
Associate III
April 11, 2022

Not sure if this helps you out, but I do not have a #define TEST_PROTECTIONS_C anywhere in my code. Instead I added it as a define symbol under the project settings in CubeIDE:

settings -> MCU GCC Compiler -> Preprocessor -> Define symbols

Clark Sann
Associate III
April 11, 2022

Thanks for that tip, @Community member​  I tried that and it did not help. If you remove it does it cause errors? When you add it, does it cause the #if define block in sfu_fwimg_regions.h to become active? I can’t figure out why the if define block is never active.

MBax.2
Associate III
April 11, 2022

I just edited my post after you replied, also try to add the define symbol for your own app, the secorebin app, sbsfu and the KMS blob.

MBax.2
Associate III
April 11, 2022

A, shoot forget that, I remembered incorrectly. I only have TEST_PROTECTIONS_C defined for my own app. I did add ENABLE_IMAGE_STATE_HANDLING to sbsfu, secorebin and kmsblob

Clark Sann
Associate III
April 11, 2022

HA! Don't worry about it. I APPRECIATE YOUR HELP! I am have always planned to add ENABLE_IMAGE_STATE_HANDLING after I got everything else working. But what the heck, I am totally stopped right now so I will go ahead and try it. I'm not sure about the KMS blob, where is that and where / how did you add ENABLE_IMAGE_STATE_HANDLING to it?