2023-08-24 6:42 AM
Hello Support team,
We are working on the Class-B on STM32U585 microcontroller-based product.
We have added the ThreadX support in the X-CUBE-CLASSB-U5(STL) library example code.
SW Configuration :
- STL library runs the Secure region
- STL APIs calling from Non-secure regions through a Non-secure callback function or Gateway
Issue :
When we run the TM7 STL test in the thread, the device enters into a hard fault due to assessing the secure region.
Counter Measurement check :
- STL must be executed with privileged mode. The control register value is showing TM7 in the privileged mode (nPRIV bit)
- STL is running in the processor mode. The control register value showing PSP mode (SPSEL bit)
- As per debugging, the TM7 test executes the External memories areas (0x6000 0000
0xDFFF FFFF) and shows errors like not accessible due to secure region.
Queries :
- Why getting issues while executing the TM7 test run in Threadx? and not getting issues without ThreadX?
If you need more information please let me know.
I don't know exactly the root cause of the issue. Waiting for your valuable support.
Thanks & Regards,
Chintan Patel
Solved! Go to Solution.
2023-10-20 3:40 AM
Hello,
To prevent the issue there are two options:
First Option:
Second Option:
2023-10-20 5:22 AM - edited 2023-10-20 5:29 AM
Hello Petr,
Thanks for your kind support.
Option 1: We need to check.
Option 2: We already applied it to our firmware, and it is working fine.
Thanks and regards,
Chintan Patel
2023-10-20 5:55 AM
Hello,
we are considering implementation of the option 2 into the library at some next version if released but note each change of the library files means to pass new quite demanding and expensive recertification process for us. This is far from simple generation of a new object file unfortunately. So far the issue will be implemented at form of added note describing this limitation at the STL documentation. Anyway, the memory allocation is fully in user hands.
Best regards,
Petr
2023-10-25 9:17 PM
Hello Petr
I appreciate your invaluable assistance.
We're waiting on the STL FW update that has a resolved solution.
Can the ST team provide us with a solution with an intermediate STL FW release so we can on schedule apply for our product certification?
Thanks and regards,
Chintan Patel
2023-10-26 1:10 AM
Hello,
please note that no recertification of U5 FW is planned now. Planning that is long way run taking few months (agreement between UL & ST about quotation, planning men bandwidth for retesting and generating heaps of necessary reports, finding common certification time slot, approve & reserve financial resources...). I see only follow up action to be performed ASAP - upgrading the associated User manual by proper warning note.
I believe you have complete knowledge about the problem and possible workarounds applicable easily now. I suggest just to decrease the PSP & MSP limits before calling STL_SCH_RunCpuTM7 procedure at your program and renew them back just after return from it. Occasional patch will do the same at level of the TM7 scheduler. If I understand, it is just what is done already at your side.
Best regards,
Petr
2023-10-31 2:09 AM
Hello Petr,
Thanks for your valuable time and efforts.
Thanks & Regards,
Chintan Patel
2025-04-14 9:41 PM
Hi Petr Sladecek
We are working on the Class-B on STM32U5 series microcontroller-based product.
Issue:
When we run the TM7 STL test single time, so code is working fine and all STL test are passes but when we run CPU test (Tm1L, Tm7, TmCB) multiple time in every 25ms, the device enters into a hard fault.
Register "-
2025-04-24 11:36 PM
Hello @Akanksha
As per my understanding related to the PSP and MSP tests,
PSP (Process Stack Pointer):
MSP (Main Stack Pointer):
In an RTOS environment, the stack pointers are dynamically switched during context switching. If your testing involves verifying the integrity of PSP and MSP, failures may occur due to incorrect assumptions about their values during task execution.
There may be a couple of failure reasons,
Context Switching in RTOS:
Interrupts and Exceptions:
Stack Corruption:
Testing Routine Timing:
RTOS Configuration:
STL TM7 Pre-requisite:
1. If the privileged level is not set to privilege, the CPU TM7 returns STL_ERROR.
2. By default, the STM32 interrupts and Cortex® exceptions with configurable priority are masked during the CPU
TM7 except if the user application activates STL_ENABLE_IT.
If the STL_ENABLE_IT flag is activated, the correct STL CPU TM7 behavior is not guaranteed, as the pipeline
sequence is modified. This could lead the STL to generate false test error reporting or not to detect hardware
failures.
3. The STL must be executed in thread mode in order to set the active stack pointer to the process stack pointer.
If the STL is not executed in thread mode, the CPU TM7 returns STL_ERROR.
4. The STM32 interrupts, and Cortex® exceptions with configurable priority, are masked multiple times by the STL
during CPU TM7. Test duration Max : 422 Cycles and Maked Twice for 422 and 372 clock cycles
I hope this helps in debugging the TM7 issue.
Could you share the latest updates regarding the new STL library, specifically the TM7 patch and its documentation?
Thanks,
Chintan
2025-04-25 6:38 AM
Hi @Petr Sladecek,
When I was disable the interrupt before TM7 test and enable after test, then it will work properly.
Is it correct way for this testing ?
Thanks,
Pankaj
2025-04-26 12:13 AM
Thank You Chintan