If you are trying to deploy the Simulink model configured for a Pixhawk 1 flight
controller by clicking the
Build, Deploy & Start icon
() in the Hardware tab of
Simulink toolstrip, you may see the following flash overflow error towards the end
of the build process:
The reasons for this issue can be:
You have used the CMake file
which is the default for the Pixhawk 1 flight controller, but the 1MB
flash memory limit is exceeded.
The Simulink model is large, and the generated code has exceeded the 1MB flash memory limit.
To troubleshoot the issue, there are two options:
Select another CMake file for the firmware build and configuration. To do this, perform the following tasks:
From the Simulink model, open the Configuration Parameters dialog box.
Go to Target Hardware Resources > Build options pane, and click Change CMake configuration to open the Hardware Setup screen.
In the Hardware Setup screens, go to the Select CMake Configuration screen, select Custom CMake file, and then click Browse.
Select nuttx_px4fmu-v3_default.cmake, and click Open.
Click Next and proceed with the remaining steps of Hardware Setup process.
From the Simulink model, open the Configuration Parameters dialog box again, and select the option Allow flashing FMUv3 CMake configuration on Pixhawk 1.
This option should be carefully used because enabling this option will result in the following:
There will not be any check either for the selected CMake compatibility on the connected Pixhawk controller or for any silicon errata on the Pixhawk board.
If the CMake is not compatible with the Pixhawk controller, the entire board can get into a faulty state.
Hence, only use this option if you have connected Pixhawk 1 and you want to flash FMUv3 CMake on Pixhawk 1.
Click Apply and then OK to close the dialog box.
In the Hardware tab of the Simulink toolstrip, click Build, Deploy & Start () to start the process again.
If you do not want to change the CMake
px4fmu-v2_default) that is designed for the
hardware, you can also troubleshoot the issue if you change the contents of
the CMake file. To do this:
Go to the location of the CMake files in the
px4 directory (for example,
Edit the nuttx_px4fmu-v2_default.cmake file and remove the modules that you do not want to build (you can comment-out those lines).
Open the Simulink model and try the
Hardware process again.