2023-06-01 11:55 PM - edited 2023-11-20 04:09 AM
Hello everyone,
I'm working on https://www.st.com/resource/en/user_manual/um2851-getting-started-with-stm32cubeu5-tfm-application-stmicroelectronics.pdf and try to adapt it to a STM32U5Axx.
The NS app launch successfully but the Test protection already included in the NS App is not working as wanted.
The two firsts tests that it is doing are DENIED, which seems normal, and which normally should provoke a reset as written in page 59. This behaviour is well executed for the next tests but not for the two first one that leads to a TEST Protection : Failed.
Any idea why ? Thanks in advance,
Thomas
2023-06-02 01:04 AM
Hello Thomas,
The tests should provoke a reset. If it does not, this means that test fails.
The first test checks that you cannot access to SRAM2 which is dedicated to secure from non secure.
If accessing this address does not lead to a fault, this means something is wrong in the adaptation.
This is the purpose of such test.
So, I would suggest reviewing the setup of secure ram.
In secure code you can find the configuration in gtzc_init_cfg in target_cfg.c
gtzc_config_sram(SRAM2_BASE, SRAM2_SIZE, 0, DATA_NPRIV_START - SRAM2_BASE -1, 0);
gtzc_config_sram(SRAM2_BASE, SRAM2_SIZE, DATA_NPRIV_START - SRAM2_BASE, SRAM2_SIZE -1, FLAG_NPRIV);
One possible issue it that you didn't define the right STM32U5 in compiler's setting in Preprocessor.
Best regards
Jocelyn
2023-06-02 02:30 AM - edited 2023-11-20 04:10 AM
Hello Jocelyn,
First I would like to thank you for your time and your quick reply.
I have carefully check the STM32U5 that I had defined in Preprocessor and I think it's good as I putted STM32U5A9xx for a STM32U5A9NJ.
I suspected that my problem must be linked to a problem with SRAM2 and I'd already spent a long time thinking about it and your advice only reinforces that idea. The configuration in gtzc_init_cfg in target_cfg.c don't have the lines that you mentioned so I guess It's not a default configuration stuff isn't it ?
I have something like this :
I will try to understand more in depth about how all the SRAM2 is working but if you have any other suggestions they will be very welcome.
Again thanks,
Sincerly,
Thomas
2023-06-02 02:54 AM
Hi Thomas,
I'm surprised, this code looks very old.
Where did you start from to do your adaptation ?
Best regards
Jocelyn
2023-06-02 03:00 AM
Hello again,
All my work is an adaptation from this GitHub : STM32CubeU5/Projects/B-U585I-IOT02A/Applications/SBSFU at main · STMicroelectronics/STM32CubeU5 · GitHub.
Apparently it is only 4 months "old".
Sincerly,
Thomas
2023-06-02 04:14 AM
Hi Thomas,
OK I'm more used to the STM32 Cube FW package but it should be the same.
Now, it seems like that the TFM_Appli is missing from the latest delivery v1.2.0 in github which is strange:
https://github.com/STMicroelectronics/STM32CubeU5/tree/main/Projects/B-U585I-IOT02A/Applications/TFM
So where did you get TFM from ?
Best regards
Jocelyn
2023-06-02 04:25 AM
Dear Jocelyn,
As right now I am only trying to make the SBSFU working, I think that I don't need the TFM_App for the moment. It should be working by itself. I think I have maybe badly titrated my first post sorry.
Or maybe I misunderstood the way it should work.
Thank you again for taking time.
Sincerely,
Thomas
2023-06-02 08:08 AM
Hi Tomas,
ok I get it now.
So, one possible issue could be that you have ported the SBSFU part but not fully the secure application part.
In secure application you setup the SAU in file SBSFU_Appli/secure/inc/partition_stm32u585xx.h
In the same directory you also have a partition_stm32u5a5xx.h but it is exactly the same because it uses macros.
Now you must be sure that STM32U5A5xx is defined.
The SBSFU configuration files in linker directory have been updated so that they adapt the mapping to the target configuration.
So, normally the porting should be straightforward.
If it still does not work, I'll try it next week
Best regards
Jocelyn
2023-06-04 11:54 PM - edited 2023-11-20 04:10 AM
Hi Jocelyn,
I hope you had a good week-end. I checked my files following your advices.
In the linker files, there is the region_defs.h file which include that :
We have for STM32U5A9xx _SRAM2_BASE_NS defined as 0x200C0000 which is corresponding to
Does this means that it is well defined ? If not what do you mean by " you must be sure that STM32U5A5xx is defined"
Thanks again,
Thomas
2023-06-05 03:09 AM
I tried to just copy + rename partition_stm32u585xx.h in partition_stm32u5a9xx.h and it seems to work. Thank you very very much !