Hello,
First I must say that this SafeTI documentation is extremely poor (and example projects are almost as poor as documentation because those are not using SafeTI functionality in boot and not doing all tests and IAR & other tests has slight differences... Windows style "help" is like a joke, it looks to be generated from source code without giving any helpful information.
you also mention every where that SafeTI example is just an example - I would say that it is just a _bad_ example :) and it is implementers responsibility to select correct tests and perform them correctly...
- This job would be A LOT of easier if that example would be made properly -> Do all possible test in boot etc. so then people could basiclally rip the code to leave the necessary tests now you have to do practically everything from scratch. Proper example would also save combined thousands of hours of work from the implementers when everyone must individually figure things out.
I list here just a couple of issues what I have encountered
========================
Issue 1) which test type maps to which unique identifier in safety manual?
Lets see for example the flash/ECC, SafeTI offers this kind of test types
- FEE_ECC_DATA_CORR_MODE
- FEE_ECC_TEST_MODE_1BIT
- FEE_ECC_TEST_MODE_2BIT
- FEE_ECC_SYN_REPORT_MODE
- FEE_ECC_MALFUNCTION_MODE1
- FEE_ECC_MALFUNCTION_MODE2
- FLASH_ECC_TEST_MODE_1BIT
- FLASH_ECC_TEST_MODE_2BIT
- FLASH_ECC_ADDR_TAG_REG_MODE // in example this is inside #if 0 in the boot sequence
- FEE_ECC_ADDR_TAG_REG_MODE // in example no one calls this in the boot sequence
And list following unique identifiers for FLASH function
FEE1 FEE Data ECC SL_SelfTest_Flash // notice, flash function tests FEE
FLA1 Flash Data ECC SL_SelfTest_Flash
FLA10 Flash wrapper diag mode 5 test SL_SelfTest_Flash
FLA11 Flash wrapper diag mode 7 SL_SelfTest_Flash
FLA12 Software test of parity logic SL_SelfTest_Flash
- So we have 5 unique identifiers and 3 test types??? That would mean that some test types makes more than 1 unique identifier but which ones?
And these for for FEE-function:
FEE8 Flash wrapper diag mode 1 test SL_SelfTest_FEE
FEE9 Flash wrapper diag mode 2 test SL_SelfTest_FEE
FEE10 Flash wrapper diag mode 3 test SL_SelfTest_FEE
FEE11 Flash wrapper diag mode 4 test SL_SelfTest_FEE
- 4 unique identifiers and 7 test types (obviously more than 1 test type is required to full fill one unique identifier but which ones)
===================================
Issue 2) Is it allowed to modify the source code of SafeTI that is not said anywhere, normally it isn't and typically safety software provides CRC or some other mean to verify that source code is intact.
- This is not said anywhere...
SafeTI code as is cannot be used with (OS and) legacy interrupts because sl_esm. has __irq and __fiq keywords in interrupt handling functions (with any documentation of course), this will result to stack/PC corruption while trying to return to upper level IRQ handler after calling these functions...
===================================
Issue 3) For fault insertion test types the return values are meaningless ie. it returns the value which was given to it. Lets take for example PSCON_SELF_TEST_ERROR_FORCING_FAULT_INJECT. Nowhere is mentioned that return value should not be checked in this case.
tStatus.stResult = ST_FAIL;
bRet = SL_SelfTest_PSCON( PSCON_SELF_TEST_ERROR_FORCING_FAULT_INJECT, TRUE, &tStatus );
DBG_PRINT( "Ret: %u, Stat: %s\r\n", bRet, tStatus.stResult == ST_PASS ? "PASS" : "FAIL" );
-->
Ret: 1, Stat: FAIL<CR><LF>
and
tStatus.stResult = ST_PASS;
bRet = SL_SelfTest_PSCON( PSCON_SELF_TEST_ERROR_FORCING_FAULT_INJECT, TRUE, &tStatus );
DBG_PRINT( "Ret: %u, Stat: %s\r\n", bRet, tStatus.stResult == ST_PASS ? "PASS" : "FAIL" );
-->
Ret: 1, Stat: PASS<CR><LF>
======================
Issue 4) for window help and source code refers to obsolete function SL_SelfTest_PBIST_ExecStatus()
======================
Issue 5) SafeTI safety manual chapter 6.1 says that init produce described in _may_ be followed... Great, examples throws something there but nothing is mapped to anything... No where is mentioned what for example this phase contains when doing it by using SafeTI functions
Is it all of these or part of these or is it implementers decision????
- SRAM_PAR_ADDR_CTRL_SELF_TEST
- SRAM_ECC_ERROR_FORCING_1BIT
- SRAM_ECC_ERROR_PROFILING
- SRAM_ECC_ERROR_FORCING_2BIT
- SRAM_RADECODE_DIAGNOSTICS // this is run in SafeTI example after phase ~42 ESMInit()
- SRAM_LIVECLOCK_DIAGNOSTICS // not run at all in the example boot sequence
======================
Issue 6) certain boot time test in SafeTI example cannot be run at least after debugger reset if FIQ interrupt has been once enabled (don't want to reveal which ones :)) - it is always nice too cpu crashing to undefined instruction... After debugger reset the FIQ in CPU register is 1 but
=====================
Issue 7) Stack definition in sl_config.h are stupidly made + those are not even used in sl_asm_api_IAR.asm!!!! which defines those again and does not even include sl_config.h :). So if do not want use default settings you must write your own ASM-function to init stack because only other option is to modify SafeTI source.
Also linker script for IAR to setup the stack is horrible, with a "minor tuning" you can defined stacks so that the length is given only one place (in linker file) and that the linker also monitors that space reserved for stacks are not exceeded --- current SafeTI solution is far from this --- Had to write own Stack initializer function which uses linker provided symbols like SVC_STACK$$Limit.
=====================
Issue 8) Init documents does not mention anything about . _errata_CORTEXR4_66_(), ja _errata_CORTEXR4_57_() and errata_PBIST_4(). What is actually correct place to execute this, HalcoGen code has had so many bugs that there is no quarantee that HalCoGens placement for these are correct...
And how about errata_PBIST_4(), you clearly recommended every where in the forums that selftest.c routines SHALL NOT BE USED instead SafeTI-routines shall be used -- there is not routine for this so selftest.c must be used against recommendations...
======================
Issue 9) as some of the selftest.c functionality is still used somehting needs to be implemented into selftestFailNotification() as this function may be called from somehere... SafeTI documentation does not instruct user to put some sensible code here
======================
Issue 10) SafeTI documentation does not provide any check list, like that issue mentioned in 9 has been handled...
======================
Issue 11) FIQ and OS (operating system) and reality that FIQ interrupt cannot be masked except changing CPU to FIQ mode manually, nothing is mentioned about this in the documentation, this must need some special handling if trying to use OS services from FIQ handler... Haven't really digged this yet but at least uc/OS tries to disable IRQ&FIQ bits in CPSR (cannot disable FIQ once it is enabled) and after that the operation system trusts that context switch cannot occur when doing it's own magic -- by a quick look it looks like OS routines cannot be called from FIQ so if for example ESM high comes then some other means are needed to handle it... Maybe some other OS or port of uc/OS has tackled this issue some how.
=====================
There would "millions" of these issued but I stop here, this just shows that SafeTI maturity is far from "just integrating " the safety to the project. I have spent days (read actually weeks) just to make linker-scripts, own asm stack initalizers, proper boot-sequence (and this isn't even finished yet) by using SafeTI functionality "only" with capability to store test results over RAM pbist&init... And I am 100% sure that everyone must stumble to same things and first figure out why after certain test in boot comes the undefined instruction for debugger reset is given, why stacks will overflow even everything is set correctly in sl_config.h and in the linker and so on (these setting won't help cause asm overrides them :) (not funny))...
I am also 100% sure that current SafeTI example could be turned to nearly perfect by using a couple of days by a person who is expert in coding and hercules safety functionality - just wondering why TI haven't done this, current situation is far from marketing material... Current example just compiles that's it.. And when this example is fixed then a bit more is needed to fix the documentation, currently unique identifier list & mappings to SafeTI functions (without test types of course...) is only valuable information what it provides...