How upload/program eIQ code and model in separate memory addresses.

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

How upload/program eIQ code and model in separate memory addresses.

2,508 Views
lars1
Contributor III

I am using a MIMXRT1064-EVK developing an eIQ application where the code is 2MByte and the model is 6MByte, it will be 12 Mbyte when finished. I am running the code from the RT1064 internal memory and want to store the model in RAM if that is possible (the 32MByte Board SDRAM) while developing. Is there some way using the MCUXpresso IDE that I can write the model to SDRAM?

The code is easily compiled and uploaded to the Flash memory on the MCU but I see no easy way of uploading the model. I am aware of that I could use the board QSPI Flash or HyperFlash but still, I cant see how the model can be uploaded to them either from the IDE.

I use the SEGGER JLink in this case and they have a tool, JMEM for reading/writing of memory locations but it doesn't seem to work well with the EVK. It would be better, of course, using the MCUXpresso IDE.

I suppose that you have thought of the situation with larger NN flat models that have to be stored for eIQ and what are your suggestions for loading them onto, first the EVK and later in production?

For production, of course, a Flash memory can be used to store the model separately?

Labels (1)
0 Kudos
4 Replies

2,385 Views
lars1
Contributor III

After some further investigation, I found that the way to place the model (constant data) in a separate memory location from the program flash is to use the following method. I place my model in Hyperflash (Flash2).

The board and drivers must be modified first according to the instructions for using the HyperFlash.

The HyperFlash must be added to the memory map.

The model declaration then has to be done like this:

#include <cr_section_macros.h>

__RODATA(Flash2) const char mobilenet_model[] __ALIGNED(16) = {

0x18, 0x00, 0x00, 0x00, 0x54, 0x46, 0x4C, 0x33, 0x00, 0x00, 0x0E, 0x00,
0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00,

.

.

.

0x06, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x04, 0x06, 0x00,
0x08, 0x00, 0x07, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
};

The model is placed in the HyperFlash and the program runs on the internal RT1064 Flash.

0 Kudos

2,385 Views
lars1
Contributor III

Hi Juan,

Thank you for your reply. I can generate the code and it seems to work.

I need to place the model in an external (hyper) Flash memory since the internal 4MB is too small. I can link both the code and the model to the external Flash by setting it as no1 default, but I would like to have the code in the internal RT1064 Flash and the model in the external (Hyper) Flash. It fails when I try to set the data .data (see above declaration of my model) to a specific address using the MCUXpresso setting Managed Linker Script as:

Description: *(.data)

Region: Flash2 (External Hyper Flash)

Section Type: .data

When building I get this warning and the model was not linked to Flash2:  "Warning: ignoring changed section attributes for .data"

What is the best way to link the .data section to the external Flash?

Thanks

0 Kudos

2,384 Views
lars1
Contributor III

Possibly defining the model as a constant table and assigning a memory address for it would work but will the IDE program it into the right memory area?

EX.

const char __attribute__((section (".data"))) mobilenet_model[] __ALIGNED(16) = {

0x18, 0x00, 0x00, 0x00, 0x54, 0x46, 0x4C, 0x33, 0x00, 0x00, 0x0E, 0x00,
0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x14, 0x00,

.

.

.

0x06, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x04, 0x06, 0x00,
0x08, 0x00, 0x07, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
};

0 Kudos

2,385 Views
jc_pacheco
NXP Employee
NXP Employee

Hi Lars,

It should work. You can verify where it was placed in the memory map file after compiling: Debug/<project name>.map and look for the variable or function name.

0 Kudos