7070 - MachXO5-NX: How to perform Dual-Boot using MachXO5-NX?
See below for steps on how to perform Dual-Boot in MachXO5-NX
Background:
The current implementation of Dual-Boot is that the JUMP table is found at Address 0.

We are changing the implementation of Dual-Boot as below. For this new implementation, the JUMP table will now be located
at Address Y which is the last block of USERDATA (8). The primary image will now be located in Address 0.
Note:
*This way, the USERDATA 8 (Address Y) will be used for the JUMP table storage location.
The user should not modify any data from the USERDATA8 partition or else the JUMP table will be corrupted and then Dual-Boot will not work.

See below for steps and requirements on how to achieve the new Dual-Boot implementation.
REQUIREMENTS:
a.) Radiant Software 2023.1 or above
b.) Radiant Programmer 2023.1 or above
c.) Deployment Tool 2023.1 or above
STEPS:
In this example, the CFG0 was used as primary image and the CFG1 was used as the golden/secondary image.
IMAGE_0 means CFG0
IMAGE_1 means CFG1
IMAGE_2 means CFG2
Part#1: Radiant Software Global Settings
1.)
1a) Set BOOTMODE to DUAL
1b) Set CUR_DESIGN_BOOT and PRIMARY_BOOT to IMAGE_0 (CFG0)
Note: Primary Image must always be stored to address 0 and occupying CFG0.
1c) Set SECONDARY_BOOT to either IMAGE_1 or IMAGE 2.
Note: The golden/secondary image can be stored either in CFG1 or CFG2.
1d) Set FLASH_CLK_FREQ to the supported frequency (3.5MHz is the default value)
1e) Set CONFIG_IOSLEW to FAST (SLOW is the default value)
Note: FAST slew rate is required to operate at a higher flash clock frequencies
Illustration: Radiant Global Settings

Part#2: Flash Access IP Settings
2.)
The Flash Access IP enables you to perform write and read access to the internal flash memory. You can use this IP to routinely update your primary image in user mode. Follow the steps below to enable the configurable attributes of the Flash Access IP needed to support the Dual Boot feature. You can skip Part#2 steps if you don't have the Flash Access IP in the design.
Note: You may use Internal Flash Controller IP or Radiant Programmer Background Flash Programming via JTAG/SSPI interface to update your primary image in user mode.
Reference Link: https://www.latticesemi.com/view_document?document_id=53562
Note: Setting the "Use CFG0 with size (blocks)" to "0" means that you are telling the Flash Access IP that the CFG0 data will be used for configuration purposes (as primary booting image in this case).
This is so that you can update the primary image via Flash Access IP in the field while the Flash Access IP is running (User-functional mode).
2a) Instantiate the FLASH ACCESS IP in your design
2b) Set "Use CFG0 with size (blocks)" to "0" or else the Radiant Software will prompt an error during compilation.
2c) Set "Use CFG1/CFG2 with size (blocks)" to "11" or "15" depending on where you stored your golden/secondary image. In this case, we stored the golden/secondary image to CFG1.
2d) Click the "Generate" button once done setting these up
Illustration: Flash Access IP Settings

Part#3: Deployment Tool Dual Boot Image (.mcs) Generation
3.)
Follow the steps below to generate a dual boot image once the .bit files for the primary image and golden image are ready.
3a) Create New Deployment
3b)
*Function Type : External Memory
*Output File Type: Dual-Boot
*Click OK
Illustration: Illustration 3b

3c) Select the Input Files (.bit) then input the primary image and golden image. Click Next.
Illustration: 3c

3d)
*Output Format: Intel Hex
*SPI Flash Size (Mb): 32Mb
*SPI Flash Read Mode: Standard Read (Default Setting); User can set it to Fast Read/Dual I/O Read/ Quad I/O Read to achieve fast configuration time
Note: In Deployment Tool 2023.2, the default setting will be Quad I/O SPI Flash Read
*Select the primary pattern from the drop-down (this will be fixed in address 0,the user don't need to set the address)
*Select the golden pattern and the corresponding address for it, it can be either 0x0010_0000 (CFG1) or 0x001F_0000 (CFG2)
This depends on what you have used as your golden image. In this case, we used CFG1 so the address would be 0x0010_0000.
*Click Next
Illustration: 3d

3e) Select the directory to save the output Dual-Boot file (.mcs)
You can rename the file as you wish then click Next.
Illustration: 3e

3f) Click on Generate button, then you should see that the .mcs file has been generated successfully in the GUI.
The .mcs file generated will be used for internal flash programming (see part#4).
Illustration: 3f

Part#4: Programming the Dual-Boot image (.mcs) in the internal Flash via Radiant Programmer
4a)
Launch Radiant Programmer with the settings below
*Target Memory: FLASH Configuration Memory
*Port Interface: JTAG/SSPI
*Access Mode: Direct Flash Programming/ Background Flash Programming
*Operation: Erase, Program Verify
*Tick the checkbox beside "Flash Header Programming Options" only then input the generated .mcs file previously
*Although only the Flash Header was selected in the Radiant Programmer, this will already program the primary image, golden image, and JUMP table.
Illustration: 4a

4b) Click OK and then start the programming operation. Once successful (as shown below), perform either power-cycle or refresh to load the new image.
If the primary image fails to load, then the device will fall back to load the golden image.
Illustration: 4b

KNOWN LIMITATIONS:
* The address for the JUMP table is 0x3F_FF00 (currently USERDATA8). The user should not modify any data on it or else the JUMP table will be corrupted and then Dual-Boot will not work.
The Radiant Programmer 2023.2 version will disable the options to program all other flash partitions if the user inputs a Dual-Boot image (.mcs).