cancel
Showing results for 
Search instead for 
Did you mean: 

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.

peterd
Associate II
 
23 REPLIES 23
Jocelyn RICARD
ST Employee

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
Associate II

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

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
Associate II

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

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

@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
Senior

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
Senior

@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
Senior

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