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

MBax.2
Associate III
April 11, 2022

when I remove TEST_PROTECTIONS_C from my projects define symbols and build, I get the errors:

ug/../AWS/ota/app/pal/SFU_Services/sfu_app_new_image.c:54: undefined reference to `SlotStartAdd'

ebug/../AWS/ota/app/pal/SFU_Services/sfu_app_new_image.c:94: undefined reference to `SlotStartAdd'

Clark Sann
Associate III
April 11, 2022

I am using the SBSFU_v2.6.0 version of SECoreBin, SBSFU, and UserApp to experiment with your changes. The first thing I did was remove test_protections.c from the build of UserApp. That causes several undefined errors.

Then I added TEST_PROTECTIONS_C to UserApp. Still got errors.

Then I added TEST_PROTECTIONS_C to SECoreBin. Before doing that it build. After doing that I have several duplicate references. I am in the process of finding the duplicated references. They seem to be duplicated with references in se_low_level, se_callgate, se_exception, se_fwimg, se_user_application, and se_utils. What a mess.

I'm in no way an expert in complicated projects like this, but I suspect there is a fundamental design problem here somewhere. Either that or I have somehow totally ruined my set of projects for UserApp based on SBSFU v2.6.0. I doubt it because they do build and work....until I remove test_protections.c.

MBax.2
Associate III
April 11, 2022

I'm no expert either, I found getting SBSFU up and running quite challenging and ran into bugs too. When I finally got it to work, I jotted down all the steps I took in a notebook to make sure I could reproduce it for future projects. I can share my notes, but not here, it has some client sensitive naming in it I think. Shoot me a mail. Contact info on baxedm.com

Jocelyn RICARD
ST Employee
April 13, 2022

Hello guys,

It seems there is a misunderstanding about this TEST_PROTECTIONS_C 

This flag is only used when performing the test of protections in user application.

As you can see in test_protections.c

#include "sfu_fwimg_regions.h" /* required for corruption tests (a real user application should NOT need this file) */

So, when developing your own application and if you want to access to the mappings for managing OTA, you can have a look in fw_update_app.c:

if defined(__CC_ARM) || defined(__ARMCC_VERSION)
#include "mapping_fwimg.h"
#include "mapping_sbsfu.h"
#elif defined (__ICCARM__) || defined(__GNUC__)
#include "mapping_export.h"
#endif /* __CC_ARM || __ARMCC_VERSION */

Basically, take this file as example.

Best regards

Jocelyn

Clark Sann
Associate III
April 13, 2022

@Jocelyn RICARD​ OK, I understand we are not supposed to use TEST_PROTECTIONS_C. But I am not sure what you are suggesting we do to eliminate the undefined reference to `SlotStartAdd and 'SlotEndAdd' errors. I have tried every combination of the 3 includes you show above, and in every case I still get undefined reference errors.

Furthermore I have been unable to find any documentation about when _CC_ARM, __ARMCC_VERSION, and __ICCARM__ should be used. I would certainly appreciate any documentation you can provide regarding these switches.

It should be easy for you to duplicate what I am seeing. Simply go to your UserApp example and exclude test_protections.c from the build. You should get several undefined reference errors.

I would appreciate knowing what you do to resolve these errors. Everything I have tried fails.

Once I get UserApp to build without test_protections.c, I can use that configuration to make my custom app also build without test_protections.c.

Thank you for looking at this.

Clark

Jocelyn RICARD
ST Employee
April 14, 2022

Hello Clark,

Thank you for providing information to reproduce the issue.

This issue is related to the definition of const values inside the sfu_fwimg_regions.h.

I'm not fan of this way of doing things but it was done like this ...

The const values are protected by this flag TEST_PROTECTIONS_C

The name is really not the good one because the definitions are related to the mapping;

So, sfu_fwimg_regions.h. can be included by several c files, but only one should define the TEST_PROTECTIONS_C flag,

In the example, this flag is defined in test_protections.c.

If you remove this from the build, you can for instance set the #define TEST_PROTECTIONS_C in fw_update_app.c before the #include "sfu_fwimg_regions.h"

If you also comment the call to TEST_PROTECTIONS_RunMenu() in main.c you should get a successful build.

I hope this will help

Best regards

Jocelyn

Clark Sann
Associate III
April 14, 2022

@Jocelyn RICARD​ Thank you for providing help to resolve this problem. Of course, your solution works perfectly. I've also adapted your earlier solution, which fixes the problems caused by the new compiler, somy app to use certain functions needed after I turn on ENABLE_IMAGE_STATE_HANDLING. Right now I think I have all the tools I need to complete my custom app using SBSFU.

Jocelyn RICARD
ST Employee
April 14, 2022

Hi @Clark Sann​ ,

thank you for your feedback.

Good to know this is working fine now :)

Best regards

Jocelyn

ATura.1
Visitor II
April 14, 2022

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.