RT117x: dual image boot order

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RT117x: dual image boot order

Jump to solution
722 Views
mastupristi
Senior Contributor I

Hello,

I am trying the "dual image" feature on RT117o EVK.
On Provisioning tool there is Image version field:

imageVersion.png

in the popup it says: "Image with the higher image version is booted first".

This is openly at odds with flowcharts:

flowchart.png

point me to the section in the Reference Manual or Security Reference Manual where this feature is detailed?

However, I also tried (see attached project):

  • both images have the same version: I can jump from one to the other and it always starts image 0
  • image 0 has 0x0012FFED, image 1 has 0x0013FFEC: both images can jump into the other, image 0 always starts
  • image 0 has 0x0013FFEC, image 1 has 0x0012FFED: always starts image 1 and fails to jump to image 0.

diff.png

 

Bottom line: is this feature really present on RT117x? And how is it used?

 

regards

Max

0 Kudos
Reply
1 Solution
673 Views
mastupristi
Senior Contributor I

I got the point (I had missed it on a first reading)

 

expla.png

 

View solution in original post

0 Kudos
Reply
3 Replies
698 Views
mastupristi
Senior Contributor I

I have progressed in my knowhow. I modified my example a bit to test a theory I had.

        PRINTF("input 'y' to switch firmware to run!\r\n");
        PRINTF("input other char to stay in the current firmware!\r\n");
        ch = GETCHAR();
        PUTCHAR(ch);
        PRINTF("\r\n");
        for(uint32_t i=0;i<0x1000;i++);
        if(ch == 'y')
        {
          LPUART_Deinit(BOARD_DEBUG_UART_BASEADDR);
          if(firmware_index)
          {
            bl_firmware_switch(0);
          }
          else
          {
            bl_firmware_switch(1);
          }
        }
        else if(ch == '0' || ch == '1')
        {
        	int target = ch - '0';
        	PRINTF("forcing reboot from image %d\r\n", target);
        	for(uint32_t i=0;i<0x1000;i++);
        	LPUART_Deinit(BOARD_DEBUG_UART_BASEADDR);
        	bl_firmware_switch(target);
        }

this example is inspired (or adapted) from AN12255's example. The changes I made are that, in addition to 'y' (which starts the "other" image), you can press '0' or '1' to force the start of the images indicated by the character.

I wrote this FW in both slot 0 and 1. In slot 0 it has image version 2 (0xFFFD0002), while in slot 1 it has 1 (0xFFFE0001). So the one to start must always be slot 0.

Effectively at reset slot 0 starts, and the "jumps" from one slot to another are consistent:

@@@@@@@@@@@@ Hello world! This is firmware image 0
Firmware 0 start to run!
please input char for switching firmware, current count: 1
HADDRSTART         0
HADDREND           0
HADDROFFSET        0
input 'y' to switch firmware to run!
input other char to stay in the current firmware!
y

************ Hello world! This is firmware index 1
welcome to run firmware 1!
please input char for switching firmware, current count: 1
HADDRSTART  30000001
HADDREND    30200000
HADDROFFSET   200000
input 'y' to switch firmware to run!
input other char to stay in the current firmware!
y

@@@@@@@@@@@@ Hello world! This is firmware image 0
Firmware 0 start to run!
please input char for switching firmware, current count: 1
HADDRSTART         0
HADDREND           0
HADDROFFSET        0
input 'y' to switch firmware to run!
input other char to stay in the current firmware!
y

************ Hello world! This is firmware index 1
welcome to run firmware 1!
please input char for switching firmware, current count: 1
HADDRSTART  30000001
HADDREND    30200000
HADDROFFSET   200000
input 'y' to switch firmware to run!
input other char to stay in the current firmware!
y

@@@@@@@@@@@@ Hello world! This is firmware image 0
Firmware 0 start to run!
please input char for switching firmware, current count: 1
HADDRSTART         0
HADDREND           0
HADDROFFSET        0
input 'y' to switch firmware to run!
input other char to stay in the current firmware!
1
forcing reboot from image 1

************ Hello world! This is firmware index 1
welcome to run firmware 1!
please input char for switching firmware, current count: 1
HADDRSTART  30000001
HADDREND    30200000
HADDROFFSET   200000
input 'y' to switch firmware to run!
input other char to stay in the current firmware!
1
forcing reboot from image 1

************ Hello world! This is firmware index 1
welcome to run firmware 1!
please input char for switching firmware, current count: 1
HADDRSTART  30000001
HADDREND    30200000
HADDROFFSET   200000
input 'y' to switch firmware to run!
input other char to stay in the current firmware!
0
forcing reboot from image 0

@@@@@@@@@@@@ Hello world! This is firmware image 0
Firmware 0 start to run!
please input char for switching firmware, current count: 1
HADDRSTART         0
HADDREND           0
HADDROFFSET        0
input 'y' to switch firmware to run!
input other char to stay in the current firmware!
0
forcing reboot from image 0

@@@@@@@@@@@@ Hello world! This is firmware image 0
Firmware 0 start to run!
please input char for switching firmware, current count: 1
HADDRSTART         0
HADDREND           0
HADDROFFSET        0
input 'y' to switch firmware to run!
input other char to stay in the current firmware!

 

if I swap the version numbers though (slot 1 <- 0xFFFE0001, slot 2 <- 0xFFFD0002), a strange thing happens. On reset slot 1 starts, as I expected, but it looks like the slot indexes are reversed:

@@@@@@@@@@@@ Hello world! This is firmware image 0
Firmware 0 start to run!
please input char for switching firmware, current count: 1
HADDRSTART         0
HADDREND           0
HADDROFFSET        0
input 'y' to switch firmware to run!
input other char to stay in the current firmware!
y

************ Hello world! This is firmware index 1
welcome to run firmware 1!
please input char for switching firmware, current count: 1
HADDRSTART  30000001
HADDREND    30200000
HADDROFFSET   200000
input 'y' to switch firmware to run!
input other char to stay in the current firmware!
y

@@@@@@@@@@@@ Hello world! This is firmware image 0
Firmware 0 start to run!
please input char for switching firmware, current count: 1
HADDRSTART         0
HADDREND           0
HADDROFFSET        0
input 'y' to switch firmware to run!
input other char to stay in the current firmware!
1
forcing reboot from image 1

************ Hello world! This is firmware index 1
welcome to run firmware 1!
y

@@@@@@@@@@@@ Hello world! This is firmware image 0
Firmware 0 start to run!
please input char for switching firmware, current count: 1
HADDRSTART         0
HADDREND           0
HADDROFFSET        0
input 'y' to switch firmware to run!
input other char to stay in the current firmware!
y

************ Hello world! This is firmware index 1
welcome to run firmware 1!
please input char for switching firmware, current count: 1
HADDRSTART  30000001
HADDREND    30200000
HADDROFFSET   200000
input 'y' to switch firmware to run!
input other char to stay in the current firmware!
y

@@@@@@@@@@@@ Hello world! This is firmware image 0
Firmware 0 start to run!

************ Hello world! This is firmware index 1
welcome to run firmware 1!
please input char for switching firmware, current count: 1
HADDRSTART  30000001
HADDREND    30200000
HADDROFFSET   200000
input 'y' to switch firmware to run!
input other char to stay in the current firmware!
y

************ Hello world! This is firmware index 1
welcome to run firmware 1!
please input char for switching firmware, current count: 1
HADDRSTART  30000001
HADDREND    30200000
HADDROFFSET   200000
input 'y' to switch firmware to run!
input other char to stay in the current firmware!
y

************ Hello world! This is firmware index 1
welcome to run firmware 1!
please input char for switching firmware, current count: 1
HADDRSTART  30000001
HADDREND    30200000
HADDROFFSET   200000
input 'y' to switch firmware to run!
input other char to stay in the current firmware!
0
forcing reboot from image 0

************ Hello world! This is firmware index 1
welcome to run firmware 1!
please input char for switching firmware, current count: 1
HADDRSTART  30000001
HADDREND    30200000
HADDROFFSET   200000
input 'y' to switch firmware to run!
input other char to stay in the current firmware!
0
forcing reboot from image 0

************ Hello world! This is firmware index 1
welcome to run firmware 1!
please input char for switching firmware, current count: 1
HADDRSTART  30000001
HADDREND    30200000
HADDROFFSET   200000
input 'y' to switch firmware to run!
input other char to stay in the current firmware!
1
forcing reboot from image 1

@@@@@@@@@@@@ Hello world! This is firmware image 0
Firmware 0 start to run!
please input char for switching firmware, current count: 1
HADDRSTART         0
HADDREND           0
HADDROFFSET        0
input 'y' to switch firmware to run!
input other char to stay in the current firmware!
1
forcing reboot from image 1

@@@@@@@@@@@@ Hello world! This is firmware image 0
Firmware 0 start to run!
please input char for switching firmware, current count: 1
HADDRSTART         0
HADDREND           0
HADDROFFSET        0
input 'y' to switch firmware to run!
input other char to stay in the current firmware!
0
forcing reboot from image 0

************ Hello world! This is firmware index 1
welcome to run firmware 1!
please input char for switching firmware, current count: 1
HADDRSTART  30000001
HADDREND    30200000
HADDROFFSET   200000
input 'y' to switch firmware to run!
input other char to stay in the current firmware!
1
forcing reboot from image 1

@@@@@@@@@@@@ Hello world! This is firmware image 0
Firmware 0 start to run!
please input char for switching firmware, current count: 1
HADDRSTART         0
HADDREND           0
HADDROFFSET        0
input 'y' to switch firmware to run!
input other char to stay in the current firmware!

 

Can you explain this strange behavior? Or maybe you can point me to cove this feature/behavior is documented?

 

regards

Max

 

0 Kudos
Reply
687 Views
RaRo
NXP TechSupport
NXP TechSupport

Hello @mastupristi,

Could you please take a look at the i.MX RT1170 Processor Reference Manual. Section 10.13.3 Enter Bootloader API or Security Reference Manual for the i.MX RT1170 Processor. Section 2.13.3 Enter Bootloader API. There is the ARG definition table, which explains about the Boot image selection?

Warm regards, Raul.

0 Kudos
Reply
674 Views
mastupristi
Senior Contributor I

I got the point (I had missed it on a first reading)

 

expla.png

 

0 Kudos
Reply