2021-04-17 11:59 AM
ST, et. al.: My experience is that ST documents well all of the sample apps and projects, so I feel like I am stupidly missing something obvious here and make this post hesitantly. But I have lost way too much time on this issue after reading and re-reading UM2178, UM2186, & UM2708 and many readme.txt files, and other assets. To my surprise, I cannot find anyone else asking this fundamental question, so I am really feeling dumb asking.
My fundamental getting started problem with the whole AWS-IOT development package running on the B-L4S51-IOT01A is this: How in the heck do I get started developing - how can I change one line of code and then download and run from the debugger and see this change running?
I have spent several days getting oriented with this new (for me) package (note that I have many years of experience working with the STM32, STM32WB, Blue-NRG, Spirit1, and all of the ST MEMS, and decades working with IAR) and it almost killed me to finally solve this most fundamental getting started problem.
For sure, the pre-built .bin downloads and runs on the B-L4S51-IOT01A and I can right away see it in the ST Dashboard updating values. But now I want to start developing this app, making proprietary behavior, and so I need to run from the debugger. I was able to change something obvious (negating the accel Z-axis value) and build a new .bin and program that .bin and run it and see the change in the ST Dashboard - yup, now with the board in the same position as before, the Z-axis is negative. But if I download and run from the IAR debugger, the code is hung in all of the incredibly complex SBSFU code.
Is the solution to this problem really so easy and obvious to find in the code and/or the documentation? If so, please point me to it and I will delete this embarrassing post. But until then, here is my simple solution (if this helps you, please comment or like this post so that we can get ST to give us the real solution):
First, get your B-L4S51-IOT01A connecting to your ST Dashboard using the pre-built .bin and steps as outlined in the "Quick Start Guide to FP-CLD-AWS1":
Now follow exactly these steps in order to be able to download and run from the IDE debugger (through arduous trial and error, I have found how easy it is to inadvertently break the entire SBSFU system):
Open SECoreBin project:
STM32CubeFunctionPack_AWS1_V3.0.1\Projects\B-L4S5I-IOT01A\Applications\BootLoader_STSAFE\2_Images_SECoreBin\EWARM
Disable image state handling by putting a letter in front of it like this: xENABLE_IMAGE_STATE_HANDLING
Project --> Options --> C/C++ Compiler --> Preprocessor --> Defined symbols
Rebuild All
Open SBSFU project:
STM32CubeFunctionPack_AWS1_V3.0.1\Projects\B-L4S5I-IOT01A\Applications\BootLoader_STSAFE\2_Images_SBSFU\EWARM
Disable image state handling: xENABLE_IMAGE_STATE_HANDLING
Add this code snippet to sfu_boot.c:
STM32CubeFunctionPack_AWS1_V3.0.1\Projects\B-L4S5I-IOT01A\Applications\BootLoader_STSAFE\2_Images_SBSFU\SBSFU\App
/* Control if slot #0 is empty */
if (SFU_IMG_VerifyEmptyActiveSlot() != SFU_SUCCESS)
{
#if !defined ENABLE_IMAGE_STATE_HANDLING
SFU_IMG_LaunchActiveImg();
#endif
Rebuild All
Open aws_demos project:
STM32CubeFunctionPack_AWS1_V3.0.1\Projects\B-L4S5I-IOT01A\Applications\Cloud\aws_demos\EWARM
Disable image state handling: xENABLE_IMAGE_STATE_HANDLING
Rebuild All
Now what you have is a new .bin file to program with STM32CubeProgrammer:
STM32CubeFunctionPack_AWS1_V3.0.1\Projects\B-L4S5I-IOT01A\Applications\Cloud\aws_demos\EWARM\PostBuild
I think that it is necessary to first "Full chip erase", then program your new .bin which has everything bundled (i.e. the SB, SFU, and aws_demo) in one image.
Finally, now you can begin development - debug, download, and run from the IDE (instead of having to program the entire .bin file and run without being able to debug). To test this, change something obvious like I did, download and run from the debugger in the IDE.
2021-05-03 04:52 AM
Thank you @Scott L�hr for sharing the details of your solution!
I added a couple of topics for MEMS&Sensors developers to give a broader audience of this post.
-Eleon