Page 1 of 1

Problem programming Arduino mega 2560

Posted: Fri Sep 04, 2026 4:30 pm
by NiamhDaniels
Hiya, so sorry- i'm not sure if this is a bug or not, but I've been getting this error message when trying to compile to target. I have tried compiling to C, and copying and using the arduino IDE successfully, but it would be nice to be able to program via flow code ideally :?



Target folder: C:\Code
Source name: C:\Code\LED1.fcfx
Title: New Embedded Project
Description: New <Arduino Mega 2560> Embedded Project
Device: ARD.ATMEGA.ATMEGA2560
Generated by: Flowcode v11.0.2.17
Date: Friday, September 04, 2026 16:29:26
Users: 1
Registered to: NiamhDaniels (95939856)
Licence key: 2JM044
https://www.flowcode.co.uk
Using FCD settings for compiler
Launching the compiler...
C:\ProgramData\MatrixTSL\FlowcodeV11\FCD\AVR\batchfiles\avra.bat "C:\Program Files (x86)\Flowcode\Common\Compilers\avrv5\" atmega2560 "C:\Code\LED1.elf" "C:\Code\LED1.c" "C:\Code\LED1.lst"

C:\Code>REM CRC: EA277D0C7EF9B4E537B79187D0BE7A25FA6080B4B01BE48BAF713429E4B690411241251B4A05C2B5828F4452C9F7348705C640EF477B79E0C7881D2E5EEC9BD69A0D46BD3B6AACB92DE4D84759EBB5079CA9DA2D2BBCDAE2A4D1C56CD1580BF5A24465F11D9C3B2DBA3F4E37F13004EE3637760F1F0B7DA0CC623CD30E3C7D6BAB4C3FE6151D92B8EC0ADD55E96639DAC02472BDE3806EF43AE3A028BD32A5DAE68BB191DA97CB6883A66D3C41849952BB2DD264AF32733E2C3050DA273BE4EE1FA30153290F2FAFBD2259D77AD477809E9C4D76400384BA5D2E1919BC6D834D57C406BC4A49D3F1

C:\Code>REM REVISION: 1.0

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

C:\Code>REM DATE: 08\08\2022

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

C:\Code>"C:\Program Files (x86)\Flowcode\Common\Compilers\avrv5\bin\avr-gcc.exe" -mmcu=atmega2560 -Os -ffunction-sections -fdata-sections -funsigned-char -o "C:\Code\LED1.elf" "C:\Code\LED1.c" -lm -Wl,-gc-sections

C:\Code>"C:\Program Files (x86)\Flowcode\Common\Compilers\avrv5\bin\avr-objdump.exe" -S "C:\Code\LED1.elf" 1>"C:\Code\LED1.lst"

C:\Code>"C:\Program Files (x86)\Flowcode\Common\Compilers\avrv5\bin\avr-size.exe" -B -d "C:\Code\LED1.elf"
text data bss dec hex filename
426 0 0 426 1aa C:\Code\LED1.elf

Compilation successful!

Using FCD settings for linker
Launching the linker/assembler...
C:\ProgramData\MatrixTSL\FlowcodeV11\FCD\AVR\batchfiles\avrb.bat "C:\Program Files (x86)\Flowcode\Common\Compilers\avrv5\" "C:\Code\LED1.elf" "C:\Code\LED1.hex" "C:\Code\LED1.cof"

C:\Code>REM CRC: EA277D0C7EF9B4E537B79187D0BE7A25FA6080B4B01BE48BAF713429E4B69041F19754DEA3580B6825E5D6A5C09874F305C640EF477B79E0C7881D2E5EEC9BD69A0D46BD3B6AACB92DE4D84759EBB5079CA9DA2D2BBCDAE2A4D1C56CD1580BF5202CD64388F0AF24F175A82BBF7DF194C31451F662291FA2302B8E00B0793B98DE54674FED6890F09D29E6D6AF5F4CDA2A0B069D1A731E4BF7CAEBD6A00B6313A3554E78FBF27EB2E2AB377A2B2C9B1D3B75C13EB27ADD422C3050DA273BE4EEA03AAF1B2D5E9A8C92AFCC9691A050BCD9E1A3B49732FB7C850400E5B608E745107C571680B732A8

C:\Code>REM REVISION: 1.0

C:\Code>REM GUID: C4F77EBB-EDB0-4261-B01E-F0B1AB94E03A

C:\Code>REM DATE: 08\08\2022

C:\Code>REM DIR: FCD\AVR\batchfiles\avrb.bat

C:\Code>"C:\Program Files (x86)\Flowcode\Common\Compilers\avrv5\bin\avr-objcopy" -O ihex -R .eeprom "C:\Code\LED1.elf" "C:\Code\LED1.hex"

HEX file creation successful!

Using FCD settings for programmer
Launching the programmer...
C:\ProgramData\MatrixTSL\FlowcodeV11\FCD\AVR\batchfiles\avrc_arduinoB.bat "C:\Program Files (x86)\Flowcode\Common\Compilers\avrv5\" m2560 stk500v2 COM8 115200 "LED1.hex"

C:\Code>REM CRC: EA277D0C7EF9B4E537B79187D0BE7A25FA6080B4B01BE48BAF713429E4B69041072C26934F62BA2AD18E3139D88C14D79B7332D7455FC12D75A8268EAA28F070F6A4CCB7873802B223E4F4A1008A35919A0D46BD3B6AACB92DE4D84759EBB5079CA9DA2D2BBCDAE2A4D1C56CD1580BF51EB2672309F38B5BC562FCC8E801D34E93AC09C2DF3FF9CFA1C49DFB795D4181815DC88F96A50A238E0C4F48DEC430F3F09E4231F1B2C67DEC5EE0FB715C5DEC1E3E13575D5C99951E93D9EE0D2D0D01E24CC4F36E72E45E2C3050DA273BE4EE525EEC0800A860A656116A2EFD2D48328B23C29D3751446561112B2378F6127E5D3A7ED706D09BBA

C:\Code>REM REVISION: 1.0

C:\Code>REM GUID: 67C6936B-1A8D-4957-91C9-AE352304F2B6

C:\Code>REM DATE: 08\08\2022

C:\Code>REM DIR: FCD\AVR\batchfiles\avrc_arduinoB.bat

C:\Code>"C:\ProgramData\MatrixTSL\FlowcodeV11\FCD\AVR\batchfiles\..\bin\oldavrdude\avrdude.exe" -p "C:\Program Files (x86)\Flowcode\Common\Compilers\avrv5\" -P stk500v2 -b COM8 -c m2560 -U flash:w:115200
The system cannot find the path specified.

Error returned from [avrdude]

C:\ProgramData\MatrixTSL\FlowcodeV11\FCD\AVR\batchfiles\avrc_arduinoB.bat reported error code 0x3

Autoclose turned off


FINISHED



Many thanks in advance, and sorry to bother you!

Niamh

Re: Problem programming Arduino mega 2560

Posted: Fri Sep 04, 2026 5:26 pm
by mnfisher
Something is wrong with the command line to upload the program to hardware...

Should be '-p COMn -b 115200' wheres the speed seems to have been tacked on as the fiilename....

Can you look at what is in Build->Compiler options->Programmer as the command line and options.

Re: Problem programming Arduino mega 2560

Posted: Sat Sep 05, 2026 1:38 pm
by NiamhDaniels
Hi Martin,

Very sorry for the delayed response... I've attached a screenshot of the compiler options. I tried the Mega 2560 r3 instead, and this seemed to work (I don't think the board i'm using is genuine- on the front it says mega 2560, when i think it might actually be an r3). Thank you very for your help/looking into it for me :)

Cheers,
Niamh

Re: Problem programming Arduino mega 2560

Posted: Sat Sep 05, 2026 3:18 pm
by chipfryer27
Hi

When using a Mega 2560 these are my compiler settings and locations,

Compiler options.png
Compiler options.png (41.53 KiB) Viewed 768 times


Locations.png
Locations.png (40.21 KiB) Viewed 768 times

Yours should be similar. However I haven't used a Mega in ages so.......

Regards

Re: Problem programming Arduino mega 2560

Posted: Mon Sep 07, 2026 9:23 am
by Steve-Matrix
NiamhDaniels wrote:
Sat Sep 05, 2026 1:38 pm
I tried the Mega 2560 r3 instead, and this seemed to work (I don't think the board i'm using is genuine- on the front it says mega 2560, when i think it might actually be an r3).

The programmer options for the Mega 2560 are actually in the FCD (the chip definition file used by Flowcode) and not settable using the compiler options. As the "r3" is working, then I would just use that as the FCDs for the "Mega 2560 R3" is nearly identical to the "Mega 2560" with the exception of the programmer options.

Re: Problem programming Arduino mega 2560

Posted: Tue Sep 08, 2026 2:42 pm
by NiamhDaniels
Okay, thanks so much Steve!

Re: Problem programming Arduino mega 2560

Posted: Wed Sep 09, 2026 2:38 pm
by BenR
I've now pushed a change to the original Mega 2560 definition file to make it in line with the R3 version.

The none R3 version always had programming issues anyway and so the newer R3 should be much more common and it makes sense to head off this type of problem in future.