Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Moving from Arduino to actual C

Status
Not open for further replies.

Jester

Full Member level 6
Joined
Aug 18, 2012
Messages
377
Helped
7
Reputation
14
Reaction score
7
Trophy points
1,298
Location
.
Activity points
4,754
I'm working on a project and for proof of concept I used a Cortex M0 based Arduino board (MkrZero) for the micro controller portion. I have some limited experience with C and wrote the firmware using the Arduino IDE. Now that its all working I would like to move away from the speed limitations inherent to the Arduino operating system. The nice thing about the Arduino approach is the readily available open source libraries, but you pay a stiff price in performance. Most of the code I wrote is pretty basic stuff, loops and switch statements etc, so those aspects should compile under a regular C compiler.

The one aspect I'm not looking forward to is the display code, I'm using a generic SPI based 320 x 240 TFT display with touch screen, I'm actually okay with the Arduino library for the display, it works well and is not overly slow.

Assuming I get a conventional C based loop and interrupt firmware to run on this uC, is it possible to use the Arduino display library or do I need to write this from scratch?


The display : https://www.aliexpress.com/item/2-8...Touch-Screen-Panel-PCB-Board/32617643223.html

I think this is the library I used: https://www.arduinolibraries.info/libraries/adafruit-ili9341

Any suggestions from anyone that has migrated code from Arduino to regular C or suggestions for a non Arduino IDE are welcome.
 

Depends of compilier that you are using. For example, Keil uVision support c++, so you can keep using your arduino sources.
Really depends what are you trying to do. If it is just a simple gui - probably, direct driving using this library is enough.
If you need to make a kind of framebuffer with high update rate, you need to write a driver by yourself: memory -> dma -> pereferial (SPI/FSMC) -> display controller.
 
  • Like
Reactions: Jester

    Jester

    Points: 2
    Helpful Answer Positive Rating
Assuming I get a conventional C based loop and interrupt firmware to run on this uC, is it possible to use the Arduino display library or do I need to write this from scratch?

Significant part of the libraries for Arduino have their source codes available in the folder designated for the libraries, and I wouldn't doubt that this could be the case at hand, so if I were you I would make a deep search on your computer to see if it is there somewhere.

Any suggestions from anyone that has migrated code from Arduino to regular C or suggestions for a non Arduino IDE are welcome

Although Arduino loses some performance and flexibility in excess abstraction, on the other hand it is a language that gains from C by having C++ as its native SDK running in the background compilation; You can even rename the .ino file to .cpp and find that it is an accepted extension and thus take all the benefits of an object-oriented language, but this would be suited only for those who have a little more familiarity with this language.
 
  • Like
Reactions: Jester

    Jester

    Points: 2
    Helpful Answer Positive Rating
Depends of compilier that you are using. For example, Keil uVision support c++, so you can keep using your arduino sources.
Really depends what are you trying to do. If it is just a simple gui - probably, direct driving using this library is enough.
If you need to make a kind of framebuffer with high update rate, you need to write a driver by yourself: memory -> dma -> pereferial (SPI/FSMC) -> display controller.

Software is not my strong point so I'm looking for advice.

Option 1) On the Microchip website, it appears they offer a free IDE and compiler for the SAM MCU https://www.microchip.com/development-tools
Option 2) On the Microchip website, it appears they offer a SAM-ICE debugger for $150, I'm assuming that integrates with their free IDE and compiler for the SAM MCU? https://www.microchip.com/DevelopmentTools/ProductDetails/AT91SAM-ICE
Option 3) Keil offers a free evaluation version with some limitations, I'm not sure if I can work within the limitations, looks like 32k code space limit? However beyond that Keil is way beyond what I'm willing to pay

I already have the following Segger programmer, perhaps I can work with it and the free Microchip IDE https://www.digikey.com/product-det...s/8.08.91-J-LINK-EDU-MINI/899-1061-ND/7387472

Would appreciate your thoughts.
 

You can use even Visual Studio or make crosscompilation under linux. Many options to not pay anything.
 
  • Like
Reactions: Jester

    Jester

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top