CYW43907 Preserve a block of RAM across software reset

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
NiMc_1688136
Level 5
Level 5
10 sign-ins 50 questions asked 10 solutions authored

Is there a "simple" way to modify the linker for the CYW43907 to preserve a small block of ram across a SW reset to preserve some debug information, like a register dump in the case of an exception?

In a smaller environment I would create a new section in the linker and modify the startup code to skip initialization of this section. I am not sure where to start in WICED...

Any suggestions?

0 Likes
1 Solution
decac_1684766
Level 3
Level 3
10 likes received First like received

We modifed "ota2_app_without_rom.ld" and added the "fault_status_section" just after the always_on_ram section.  The (NOLOAD) property does what you want wrt to not initializing any data.

    .always_on_ram :

    {

        . = ALIGN(4);

        KEEP(*(.rodata.tinybl*))

        *(.deep_sleep_saved_vars.*)

    } > AONRAM

  

    .fault_status_section (NOLOAD):

    {

        . = ALIGN(4);

        *(.fault_status)

    } > AONRAM

Make sure to add an attribute to whatever you are saving off so it gets assigned to that section and then in the fault handler make sure the shutdown type is "PLATFORM_RESET_TYPE_RESET" instead of "PLATFORM_RESET_TYPE_POWERCYCLE"  (our call looks like "    platform_mcu_specific_reset( PLATFORM_RESET_TYPE_RESET );".

It has worked well for us to save off faults so we can report them to the cloud.

View solution in original post

3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

As far as I remember there is an attribute setting  in GCC named NOINIT.

A short search led to this.

Bob

decac_1684766
Level 3
Level 3
10 likes received First like received

We modifed "ota2_app_without_rom.ld" and added the "fault_status_section" just after the always_on_ram section.  The (NOLOAD) property does what you want wrt to not initializing any data.

    .always_on_ram :

    {

        . = ALIGN(4);

        KEEP(*(.rodata.tinybl*))

        *(.deep_sleep_saved_vars.*)

    } > AONRAM

  

    .fault_status_section (NOLOAD):

    {

        . = ALIGN(4);

        *(.fault_status)

    } > AONRAM

Make sure to add an attribute to whatever you are saving off so it gets assigned to that section and then in the fault handler make sure the shutdown type is "PLATFORM_RESET_TYPE_RESET" instead of "PLATFORM_RESET_TYPE_POWERCYCLE"  (our call looks like "    platform_mcu_specific_reset( PLATFORM_RESET_TYPE_RESET );".

It has worked well for us to save off faults so we can report them to the cloud.

Thanks, this looks really useful.

0 Likes