I'm using the MIMXRT1064.
I have a big header file (model.h), that is my TFlite model of about 22MB.
When I compile my project I get the following table:
As you can see I can't fit the code in the board flash.
What are the solutions?
How could I place my code or just the .h in the external flash or Sd card in order to run my project?
I think is a basic question but I'm new in Embedded development, if you could share any documents, tutorials, etc it could be helpful
good to hear that you make some progress.
After loading your Application to the Controller, do you see the Code in the external flash while debugging? Just check the memory view.
As you say you are new to Embedded development: Which optimization level have you used? Have you played with different levels?
Are you fixed to the 1064? With the 1062 - which is basically the same controller without integrated flash - you can use bigger flashes.
Thanks for your reply, actually no, I'm with the default OL -O0, I just tried with -Os but almost same size.
For the moment yes, I'm fixed with this board
How could I compile the project in the external flash?
You must have many read only Data if using Os Optimization Level hasn’t changed much, you could also try O3, but this should also not have a big effect.
I have to say I’m by far not an expert in MCUExpresso which you seem to use, therefore I can not give you a complete answer. However, if your external flash is connected to flexSPI1 like it is done on the evaluation-Board, you can add the second flash to your project, like this.
I’m not completely sure if the 1060 driver is working here, but this is the best option MCUExpresso offers. If this is not working, you have to write your own driver for loading your code to the flash.
This creates a bunch of new sections in the linker file which you can use:
Now I’m also stuck. I’m not aware of a way to define that a file, or folder should be placed to a special section via a GUI option.
So either you edit the linker file or you move code via __attribute__((section("name"))).
Maybe someone else has a better idea
Thanks for your info, I've been playing with spliting some parts of the code, etc but is not a good alternative.
Is not possible to use the external QSPI flash (8MB) to load the program?
If you have any others sugestions it could help.
Couldn’t you move code and data to the external flash? This should work via __attribute__((section(".text_Flash2"))) for code and __attribute__((section(".rodata.$Flash2"))) for read only data.
Here is a small guide how to edit the linker-script:
It is rather old, but the information should still be valid. With this you should be able to move whole files. As I said, I’m not an expert for MCUXpresso as I use a different tool, therefore there may be a more straight forward way I’m not aware of.
If your Program is bigger than the integrated Flash, there is in my opinion not much sense in using the 1064, you should check the possibility to use the 1062 with an external flash that fits your needs.
If you are using the evaluation board you could use the SD-RAM to run your application. This is of course not a final solution, but you can start to check if your application is working.
First of all thanks for your help, I have things more clear now.
I can place some code in external flash with the __atributes__ and linker script and compile OK but when I run the program It seems like the data is not there actually.
Maybe they are some restrictions to load data to external flash directly like this.
Anyway I'll keep looking solutions.
The RAM execution was a good idea, it works well, thanks