Tool/software:
I am working on the F28P559SJ9 board, using DCSM (Dual Code Security Module) to lock Flash bank4 where the crypto algorithm library is stored. My goal is to compile an index library and integrate it into a separate test project that calls the algorithm interfaces to verify the functionality.
The issues only occur when separating the algorithm and test projects into two different projects and linking them through the index library. When tested within a single project, the algorithm works without any issues.
Specific issues:
-
Global variables issue:
- I used
#pragma DATA_SECTION
to place global variables (less than 1KB) into Flashbank4. However, when debugging, I found that the memory addresses are filled with 0xFF and cannot be modified, preventing the algorithm from functioning correctly. - When I moved the global variables to local variables, a stack overflow occurred. I then allocated memory dynamically using
malloc
, which worked fine in the single project setup. However, when burning the library to Flashbank4, compiling the index library, and linking it to the test project, calling the algorithm caused an error interrupt, which seems like an invalid memory access.
- I used
-
Memory configuration and interrupt issue:
- The
.stack
and.sysmem
sections in both the algorithm project and the test project are configured identically:.stack : > RAMGS0
.sysmem : > RAMLS4
- The available space in RAMGS0 and RAMLS4 should be sufficient, but in the test project, calling the algorithm through the index library results in an error interrupt.
- The
My questions:
- Why does placing global variables in Flashbank4 using
#pragma DATA_SECTION
result in them being filled with 0xFF and unmodifiable? - Why does calling the algorithm cause an error interrupt when the algorithm and test projects are separated into two projects, despite using the same stack/heap configuration and sufficient memory available in RAMGS0 and RAMLS4?