Compile Error (Arduino MEGA 2560)

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
Brendan
Posts: 243
Joined: Tue Nov 27, 2012 12:53 pm
Location: Cambridge, UK
Has thanked: 140 times
Been thanked: 118 times
Contact:

Compile Error (Arduino MEGA 2560)

Post by Brendan »

Hi Guys.

I've ported a working project from PIC to ATMEGA2560 with 16MHz Xtal for professional application, so I'm using build target option: 'Arduino Mega 2560' for the project.

However, compile critically fails with the following message:
Device: ARD.ATMEGA.ATMEGA2560
Generated by: Flowcode v9.2.0.33
Date: Thursday, February 17, 2022 15:55:55
Users: 1
Registered to: *******(********)
Licence key: ******
https://www.flowcode.co.uk
Using FCD settings for compiler
Launching the compiler...
C:\ProgramData\MatrixTSL\FlowcodeV9\FCD\AVR\batchfiles\avra.bat "C:\Program Files (x86)\Flowcode\Common\Compilers\avrv5\" atmega2560 "C:\Flowcode_Project_Development\ATMEGA2560 PORT and TIDY-UP 170222A.elf" "C:\Flowcode_Project_Development\ATMEGA2560 PORT and TIDY-UP 170222A.c" "C:\Flowcode_Project_Development\ATMEGA2560 PORT and TIDY-UP 170222A.lst"

C:\Flowcode_Project_Development>REM CRC: EA277D0C7EF9B4E537B79187D0BE7A25FA6080B4B01BE48BAF713429E4B690411241251B4A05C2B5828F4452C9F7348705C640EF477B79E0C7881D2E5EEC9BD6FE0D8D4660AC0314F98C28BCA92AF856EFD1DB5B777140BC4D00059D7958998291880A09BBE74CF7BA3F4E37F13004EE3637760F1F0B7DA0CC623CD30E3C7D6BAB4C3FE6151D92B8EC0ADD55E96639DAC02472BDE3806EF43AE3A028BD32A5DAE68BB191DA97CB6883A66D3C41849952BB2DD264AF32733E2C3050DA273BE4EEFF12703F3DAF67B119A5A5B069403B38249A6C4D8A1304B09A437E7E2D43FD26DF891DB3086C82D6

C:\Flowcode_Project_Development>REM REVISION: 1.0

C:\Flowcode_Project_Development>REM GUID: EA0828B2-5C70-41A5-8C54-F359DD5CC88B

C:\Flowcode_Project_Development>REM DATE: 29\03\2021

C:\Flowcode_Project_Development>REM DIR: FCD\AVR\batchfiles\avra.bat

C:\Flowcode_Project_Development>"C:\Program Files (x86)\Flowcode\Common\Compilers\avrv5\bin\avr-gcc.exe" -mmcu=atmega2560 -Os -ffunction-sections -fdata-sections -funsigned-char -o "C:\Flowcode_Project_Development\ATMEGA2560 PORT and TIDY-UP 170222A.elf" "C:\Flowcode_Project_Development\ATMEGA2560 PORT and TIDY-UP 170222A.c" -lm -Wl,-gc-sections
C:\Flowcode_Project_Development\ATMEGA2560 PORT and TIDY-UP 170222A.c:542:20: fatal error: config.h: No such file or directory
Use :Include the chip adaption layer
^
compilation terminated.

??? :o

This may be obvious to Arduino aficionados, though I'm still in the dark for what is my first AVR project using Flowcode so any clues/advice appreciated to help me get compilation over the line. Possibly a FC bug but I don't feel qualified to comment.

Once complete I'll be able to program with Microchip Studio.

Thanks in advance,
Brendan

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Compile Error (Arduino MEGA 2560)

Post by medelec35 »

Hi Brandon.
Any questions relating to v9 issues should be posted on Flowcode forums
Have you run a full database update?
There are two ways.
When you first run flowcode and have the options of New Project & Open project.
Select Library Updates. It will automatically have Full database selected.
If you already have a project open, select Help ribbon, Library Updates.
Change Files in-use dropdown to Full database.
You will need to use the Reload option after.
If this does not work can you post a non-sensitive stripped-down version that shows the issue?
If You cant, then you can PM me your Flowchart, if you want to keep it private.
Martin

Brendan
Posts: 243
Joined: Tue Nov 27, 2012 12:53 pm
Location: Cambridge, UK
Has thanked: 140 times
Been thanked: 118 times
Contact:

Re: Compile Error (Arduino MEGA 2560)

Post by Brendan »

Hi Martin.

Sincere thanks for your kind support.

I posted on the V9 forum without reply, so reached out to the MatrixTSL forum for guidance. I'm generally unfamiliar with AVR micros, though the need to switch from PIC was driven by a professional project supported by popular available off-shelf assemblies featuring this micro. The ATMEGA2560 running a 16MHz clock (albeit at 5V) features all I require, so needing to create a HEX image that I can download with Microchip studio.

I regularly update FC9 libraries from the full database (i.e. not just files in use) as it never takes too long, which includes the present project where updates were unsuccessful. I'm loathe to report a bug as I recognise that many issues can cause problems - including possible personal incompetence until I become more familiar with this chip/build project.

I've provided a simple stripped-down example project, which I'd like to keep public if I can as it may help anyone else experiencing similar issues.

Thank you again,
Brendan
Example_Arduino_ATmega2560_HEX_Compile_Issue.fcfx
(28.88 KiB) Downloaded 123 times

mnf
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: Compile Error (Arduino MEGA 2560)

Post by mnf »

Hi Brendan,

The problem occurs because of the use of USB_Serial. The Arduino Mega doesn't support it. You'll need to switch to usindg the UART component (which lets you send/receive data via the USB port too...)
Example_Arduino_ATmega2560_HEX_Compile_Issue.fcfx
(29.48 KiB) Downloaded 146 times
Martin

Brendan
Posts: 243
Joined: Tue Nov 27, 2012 12:53 pm
Location: Cambridge, UK
Has thanked: 140 times
Been thanked: 118 times
Contact:

Re: Compile Error (Arduino MEGA 2560)

Post by Brendan »

Aha!

Good spot my friend... Thank you! 👏👏👏

All the best,
Brendan.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Compile Error (Arduino MEGA 2560)

Post by medelec35 »

Thanks Martin.
As the comms is via UART anyway via the built-in UART to USB, it makes sense to use the UART.
If the UART is missing incoming data, then there is a UART with a circular buffer example
Martin

Brendan
Posts: 243
Joined: Tue Nov 27, 2012 12:53 pm
Location: Cambridge, UK
Has thanked: 140 times
Been thanked: 118 times
Contact:

SOLVED: Compile Error (Arduino MEGA 2560)

Post by Brendan »

Further to replacing the USB Serial component with UART, I'm delighted to confirm the project compiled successfully.

Having since received/programmed an ATMEGA2560 board (Arduino clone) using Microchip Studio, ICSP programmer and exported 'ELF' file, the board fired up and worked straight off the bat. The only minor exception being a timer interrupt not pulsing a heartbeat LED, though something that I can live without until I've investigated further for future projects.

So, thank you both again!

Post Reply