EK-RA8D1 MCUboot swap with OSPI

Hello everyone,

Some context: 

The objective is to get a firmware update from MCUboot. I'd like to use the swap mechanism (with the scratch region to swap slots). As the image is bigger than 50% of the flash, I can't have the dual slot on the flash directly, so I wanted to use the OSPI for the updated firmware image.

I added the OSPI support, and I tested the OSPI with my application (to store the images/fonts etc...) and I can confirm the OSPI is running as expected.

I'll try to give as much information as I can on the process I followed to try to get MCUboot running: 

The next steps I'll describe are done from E2S FSP configuration view

1. Add MCUboot to the stack

THe following image shows the stack in the HAL/Common thread

And this one shows MCUboot stack itself: 

I followed different guides I could found and they all provided similar information about how to setup MCUboot and the properties to change.

Nothing fancy, only the minimal setup to get it work with slot 0 in the flash and slot 1 in the OSPI.

2. Change the properties

Now I need to configure MCUboot and the OSPI

Here is MCUboot common config:

The image 1 flash area is 0x10 0000 (1MB). So this value should be ok, but I already have a problem when setting this value: 


"Error: Attempting using more internal flash than exists on the MCU" -> Internal Flash is supposed to be 2MB.

"Error: The Flash Area Sizes must be multiples of the minimum erase size (0x80000)" -> 0x100000 is a multiple of 0x80000.

3. Configure OSPI

Then I had to configure the OSPI, but this doesn't provide any error message so I guess my only issue right now is the section 2.

Maybe I am missing something, but I don't understand how I am supposed to configure MCUboot to be able to get a swap setup that retrieves the image to swap in the OSPI. I don't mind it being slow by the way.

I used to worked a lot with Zephyr (NRF), so MCUboot setup is a concept I am familiar with. If there is any hint/help about this problem, it would save me a lot of time! 

Thank you very much.

GabrielC