Go Down

Topic: Audioino? (Read 5 times) previous topic - next topic

Nick Gammon

Try omitting '-mno-tablejump' from the build.sh file.

sdinnu

So I omitted that part, and when i tried to bootload it did not work properly. I then remembered I commented out your naked main function and so I UNCOMMENTED it and then recompiled and bootloaded and it bootloaded successfully and was able to boot. However, the same error blink occured when i tried to program. Not sure what the problem could be anymore. I even tried to change everything to the internal 8mhz clock and again it successfully boots but cannot actually be reprogrammed.

I was thinking it might help to run the bootloader in the arduino definition and when i changed the chAudioboot.c file to change the definition and then tried to build the project again this is the error I got.

Code: [Select]
~/Desktop/AudioBoot $ ./build.sh
chAudioBoot.c: In function 'setup':
chAudioBoot.c:98:4: warning: implicit declaration of function 'pinMode' [-Wimplicit-function-declaration]
chAudioBoot.c:98:20: error: 'OUTPUT' undeclared (first use in this function)
chAudioBoot.c:98:20: note: each undeclared identifier is reported only once for each function it appears in
chAudioBoot.c:99:4: error: 'Serial' undeclared (first use in this function)
chAudioBoot.c: In function 'loop':
chAudioBoot.c:104:4: warning: implicit declaration of function 'a_main' [-Wimplicit-function-declaration]
chAudioBoot.c: At top level:
chAudioBoot.c:127:6: warning: conflicting types for 'a_main' [enabled by default]
chAudioBoot.c:104:4: note: previous implicit declaration of 'a_main' was here
chAudioBoot.c:299:1: error: unknown type name 'uint8_t'
chAudioBoot.c:312:1: error: unknown type name 'uint8_t'
chAudioBoot.c: In function 'receiveFrame':
chAudioBoot.c:314:3: error: unknown type name 'uint16_t'
chAudioBoot.c:316:3: error: unknown type name 'uint16_t'
chAudioBoot.c:317:3: error: unknown type name 'uint16_t'
chAudioBoot.c:318:3: error: unknown type name 'uint16_t'
chAudioBoot.c:319:3: error: unknown type name 'uint8_t'
chAudioBoot.c:320:3: error: unknown type name 'uint8_t'
chAudioBoot.c:321:3: error: unknown type name 'uint8_t'
chAudioBoot.c:322:3: error: unknown type name 'uint16_t'
chAudioBoot.c:327:5: error: 'PINB' undeclared (first use in this function)
chAudioBoot.c:327:5: error: 'PB4' undeclared (first use in this function)
chAudioBoot.c:332:3: error: 'TCNT2' undeclared (first use in this function)
chAudioBoot.c:390:5: error: unknown type name 'uint16_t'
chAudioBoot.c:390:19: error: 'uint16_t' undeclared (first use in this function)
chAudioBoot.c:390:28: error: expected ',' or ';' before 'FrameData'
chAudioBoot.c:396:5: error: 'Serial' undeclared (first use in this function)
chAudioBoot.c:407:31: error: 'HEX' undeclared (first use in this function)
chAudioBoot.c:425:26: error: 'true' undeclared (first use in this function)
chAudioBoot.c:426:15: error: 'false' undeclared (first use in this function)
chAudioBoot.c: At top level:
chAudioBoot.c:437:25: error: unknown type name 'uint32_t'
chAudioBoot.c:437:40: error: unknown type name 'uint8_t'
chAudioBoot.c: In function 'runProgramm':
chAudioBoot.c:477:2: error: 'DDRB' undeclared (first use in this function)
chAudioBoot.c:478:2: error: 'DDRC' undeclared (first use in this function)
chAudioBoot.c:479:2: error: 'DDRD' undeclared (first use in this function)
chAudioBoot.c:480:2: warning: implicit declaration of function 'cli' [-Wimplicit-function-declaration]
chAudioBoot.c: In function 'a_main':
chAudioBoot.c:505:3: error: 'Serial' undeclared (first use in this function)
chAudioBoot.c:508:3: error: unknown type name 'uint8_t'
chAudioBoot.c:510:3: error: unknown type name 'uint16_t'
chAudioBoot.c:511:3: error: unknown type name 'uint8_t'
chAudioBoot.c:514:3: error: unknown type name 'uint8_t'
chAudioBoot.c:518:8: error: 'TCNT2' undeclared (first use in this function)
chAudioBoot.c:524:10: warning: implicit declaration of function 'digitalWrite' [-Wimplicit-function-declaration]
chAudioBoot.c:524:10: warning: implicit declaration of function 'digitalRead' [-Wimplicit-function-declaration]
chAudioBoot.c:535:12: error: 'LOW' undeclared (first use in this function)
chAudioBoot.c:541:11: error: 'PINB' undeclared (first use in this function)
chAudioBoot.c:541:11: error: 'PB4' undeclared (first use in this function)
chAudioBoot.c:550:3: error: 'HIGH' undeclared (first use in this function)
rm: audioboot.hex: No such file or directory
avr-objcopy: 'audioboot.elf': No such file
avr-objdump: 'audioboot.hex': No such file
avr-objdump: section '.sec1' mentioned in a -j option, but not found in any input file

Nick Gammon

It looks like in "Arduino" mode you are expected to compile it inside the IDE, that gives you access to the data types, Serial stuff and so on.

I copied and pasted the original loader into the IDE, changed 3 lines, and it compiled:

Code: [Select]

#define ARDUINO_PLATFORM // ( with Atmega168 ) bootloader development on arduino plattform   // uncommented it
...
#define LEDPORT (1<<DDB5);     // was  PB5
...
#define INPUTAUDIOPIN (1<<PORTD1)  // was PD1

sdinnu

Ive was able to successfully add the arduino verison of the bootloader and same problem of not being able to program it after bootloading. I think we have hit a wall and Im not sure if its worth my time anymore to continue this unless someone else can do some testing. I wish I knew more about bootloaders so I could write my own. I really like the idea of an audio based bootloader since it would be especially attractive in a commerical product and overall is easier to implement 1 wire rather than 6 for ICSP.

Do you know of any other neat bootloaders? I am trying to make my project easier to program than using ICSP, hoping to bring it down to 2 datawires.

Nick Gammon

The standard bootloader only uses 3 wires: Tx, Rx, Gnd. So when you say 1 wire you mean 2 wires (as you acknowledge).

I'm not sure you are saving a heap by going down this path.

In a commercial product reliability would count for something, and having 1-wire (plus Gnd) means you don't get any acknowledgement so you don't know for sure if you changed the program.

Go Up