Flash Simulink generated code onto Arduino Mega 2560 using Atmel Studio 7

4 visualizzazioni (ultimi 30 giorni)
For my project I need to flash simulink generated code onto an Arduino Mega 2560 using Atmel Studio 7 ('AS7' from here on). First of all I want to ask is whether this is possible? If yes then what steps I should follow and if no then what changes I need to make to my workflow to make something like this happen.
The following is the tasks I have already performed:
  1. I have created a model and using Simulink I/O run it succesfully on Arduino hardware.
  2. Configured the preferences for Code generation process.
  3. Generated the code using embedded coder by selecting 'Arduino Mega 2560' in the 'Hardware Implementation' tab in configuration pane.
  4. Imported all the generated files in AS7.
  5. Found and included all the necessary libraries.
  6. When trying to build the project I am met with an error associated with the linker and something to do with linking the header files.
Please guide me regarding to if/how I can sort this issue.
The SS of the errors that occured:

Risposte (1)

Arun Kumar
Arun Kumar il 11 Giu 2020
Hi Ashu Biz,
The workflow that you are trying to follow is possible but with a few modifications.
During build of the project inside MATLAB, there are certain environment variables and build information that is used to generate and build code which is not available outside MATLAB. So, you might not be able to build the code outside the MATLAB environment but it is possible to flash and debug the code using other tools like Atmel Studio.
For debugging your code in Atmel studio, follow the following steps:
  1. In your Simulink model, open Configuration Parameters, and go to Code Generation pane. In the "Build configuration" drop down, select "Debug".
  2. In Atmel studio, go to File -> Open -> Open Object File For Debugging
  3. In the "Select the Object File to Debug" input, select the elf file generated by the model and click next.
  4. In the next window, select the device and click finish.
Once you load the object file into the ide, all the libraries and dependencies required for debugging will be resolved automatically.
Now you can flash and debug the code from IDE.
Please note that you will not be able to build the code from ide because of the reason mentioned earlier. But it is possible to bulid the code inside MATLAB by using gmake command.
Hope this helps!

Categorie

Scopri di più su Arduino Hardware in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by