In a Bootloadable project, I need to access CyResetStatus but it always says CY_RESET_SW, regardless of how the chip reset.
This is caused by the the bootloader running on startup, which exits with CySoftwareReset(). This overwrites whatever was in CyResetStatus previously.
Is there a way for the Bootloadable project to correctly determine the reset status as seen by the Bootloader?
Or, is there a way for the bootloader to copy that information somewhere for the Bootloadable to read? For instance, how could I create a NOINIT variable in both projects that would share the same memory location?
A global in both projects: CY_SECTION(".reset_info") volatile struct t_reset_info reset_info; Then in the linker script of each project: MEMORY { rom (rx) : ORIGIN = 0x0, LENGTH = 262144 ram (rwx) : ORIGIN = 0x20000000 - (65536 / 2), LENGTH = 65536 - 128 nld (rw) : ORIGIN = 0x20000000Read more
A global in both projects:
Then in the linker script of each project:
That way, it’s certain that the two programs will both have access to the same NOLOAD memory, and neither will corrupt it by having the memory used for anything else.
See less