Pages: [1]   Go Down
Author Topic: Not Sure What I Need: Streamline Uploading Process  (Read 1531 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8856
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 616
Posts: 49444
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 616
Posts: 49444
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

0
Offline Offline
Full Member
***
Karma: 4
Posts: 218
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
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
Logged

0
Offline Offline
Full Member
***
Karma: 4
Posts: 218
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
« Last Edit: October 03, 2012, 03:21:46 am by april » Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley
Logged

Pages: [1]   Go Up
Jump to: