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
Clark Sann
Senior

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
Senior

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
Senior

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

MBax.2
Senior

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
Senior

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.

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?

MBax.2
Senior

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

OK, when I add ENABLE_IMAGE_STATE_HANDLING to SECoreBin and SBSFU they build. When I then add TEST_PROTECTIONS_C to UserApp, it doesn't build. Instead it complains about multiple definitions of SlotStartAdd, SlotEndAdd, and SlotHeaderAdd in sfu_app_new_image and sfu_fwimg_regions.h.

Jocelyn RICARD
ST Employee

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
Senior

@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