Not Sure What I Need: Streamline Uploading Process

I am very new to all of this and I've got a question that I really don't know how to even ask. Let me describe my situation and then maybe someone here can tell me 1) if it can be done and 2) where I should look to learn how to do it. I'm such a novice, I don't even know how to research my question.

I'd like to do this in baby steps, but the end goal is to build a cross platform, graphical user interface that basically takes a file and loads the data into an array that is uploaded on the Arduino Mega. (Right now, I've made a simple C++ script that I run through a command prompt. It reads the .txt file and then builds the Arduino sketch based on the data it finds in the .txt file. Then, I have to copy the text into the Arduino software and upload that to the board. I want to streamline and idiot proof this process so that the end user can simply double click an icon, load a .txt file, choose a couple of parameters and then click "upload" and the program will build the code and upload it to the Arduino)

Is this something that is realistically doable? Where should I go to learn what I need to learn? Are there any good tutorials? How can I succinctly state my question to maximize the effectiveness of my Google searches? (I'm somewhat familiar with C++ and that's about it, by the way ... ...)

Thanks!

You can use the STK500 protocol to ask the bootloader to write data into FLASH memory on the Arduino. You can find documentation for the STK500 protocol on the Atmel website.

As an alternative you can use the same "avrdude" program that the Arduino IDE uses. It takes a .hex file and copies it to the FLASH memory using the bootloader.

You can also invoke the compiler/linker from the command line or a make file, so there is no need to use the IDE at all.

Hey Paul, could you give me some more details about invoking the compiler from a make file? I'll do some Google searching also. I'm definitely a novice here so any help is appreciated!

I'll do some Google searching also.

Where you'll find more than you ever wanted to know.

Enable verbose mode in the IDE when compiling (how depends on which version of the IDE you are trying to avoid using), to see what commands it invokes when you compile/link/upload.

Here is a simple makefile example.
What it does is define constants like PROJECT or SOURCE and gives them a value you choose.
Then that is run by a make command which is an automake type program which compiles the program according to your makefile's instructions

PROJECT=blink
SOURCES=$(PROJECT).c
MMCU=atmega328p
F_CPU=10000000

# The serial port of your Arduino board (if using Arduino as ISP):
# - on Mac OS X, use: /dev/tty.usbserial-*
# - on Windows, use the appropriate COM port, e.g.: COM3
# - on Linux, use: /dev/ttyUSB0
SERIAL=/dev/ttyUSB4

CFLAGS=-mmcu=$(MMCU) -DF_CPU=$(F_CPU) -Os

$(PROJECT).hex: $(PROJECT).out
	avr-objcopy -j .text -O ihex $(PROJECT).out $(PROJECT).hex

$(PROJECT).out: $(SOURCES)
	avr-gcc $(CFLAGS) -o $(PROJECT).out $(SOURCES)

program-arduinoisp: $(PROJECT).hex
	avrdude -p $(MMCU) -P $(SERIAL) -c stk500v1 -U flash:w:$(PROJECT).hex

program-avrisp2: $(PROJECT).hex
	avrdude -p $(MMCU) -P usb -c avrisp2 -U flash:w:$(PROJECT).hex

program-usbtiny: $(PROJECT).hex
	/arduino-1.0.1/hardware/tools/avrdude -p $(MMCU) -c usbtiny -U flash:w:$(PROJECT).hex

clean:
	rm $(PROJECT).out $(PROJECT).hex

tms8c8:
I'd like to do this in baby steps, but the end goal is to build a cross platform, graphical user interface that basically takes a file and loads the data into an array that is uploaded on the Arduino Mega. (Right now, I've made a simple C++ script that I run through a command prompt. It reads the .txt file and then builds the Arduino sketch based on the data it finds in the .txt file. Then, I have to copy the text into the Arduino software and upload that to the board. I want to streamline and idiot proof this process so that the end user can simply double click an icon, load a .txt file, choose a couple of parameters and then click "upload" and the program will build the code and upload it to the Arduino)

Well that seems like a big ask if you have little experience.
One way might be with an arduino IDE going you would put your program (whatever you are doing with the text) in a sketch and develop it to read your text file into an array you have set up for the purpose and then when it compiles transfer it to the chip

The answers can only be general without a more detailed idea of what you want to do with the text file in the long run?

Thanks for the help, April. General answers are fine for now since I'm at the stage where I just need to know where to look and what to look for in terms of doing research. I don't want to spend hours going down the wrong path!

I need to do some more thinking on the project, but what you describe is basically where I am at. In fact, in this application, it may be desirable to have to different, independent Arduinos running and communicating via I2C data bus. If I go this route, then it would be easy enough to have on the Arduinos run a setup where it reads an SD card with a text file or etc and then creates an array based on the data that it passes to what I refer to as the "main" Arduino board that is doing most of the time critical processing.

And maybe that all sounds like nonsense to people who know what they are doing. Like I said, I need to do a lot of research still :slight_smile: