Author Topic: ATMEGA 644P AVR Programming Help Needed  (Read 2199 times)

0 Members and 1 Guest are viewing this topic.

Offline MidphaseTopic starter

  • Contributor
  • Posts: 31
  • Country: us
    • KaysLABS
ATMEGA 644P AVR Programming Help Needed
« on: June 01, 2024, 12:32:37 am »
I am trying to install a boot loader on an ATMEGA644P and I'm afraid I'm totally way in over my head. This is for a desktop synthesizer, and unfortunately the instructions provided are fairly cryptic to me, including what app I'm supposed to use exactly or how to go about it. I got me an AVRISP mkII programmer connected to my computer, and I was wondering if someone might be able to give me an idea of how to go about what these instructions instruct me to do?

https://pichenettes.github.io/mutable-instruments-diy-archive/shruthi/firmware/

I appreciate all the help any of you can provide.

Many thanks!

 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3964
  • Country: nl
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #1 on: June 01, 2024, 05:41:56 am »
There are many examples on how to do this in the Arduino world.



Search on google with "arduino upload bootloader avrisp" and you will find lots of information.

Offline MidphaseTopic starter

  • Contributor
  • Posts: 31
  • Country: us
    • KaysLABS
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #2 on: June 01, 2024, 04:52:08 pm »
Thank you, I have (I only post for help after I feel I've exhausted my Google/YouTube options). I'm not finding anything specific to the ATMEGA 644 which I think is what has me a bit confused. Part of the problem is that the Arduino IDE app doesn't appear to be connecting to the ATMEGA, and it doesn't appear to have an option for the 644 which I suspect might be part of the issue.

A lot of the YouTube tutorials assume a pre-existing familiarity with the tools which I don't have quite yet.
 

Offline pqass

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: ca
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #3 on: June 01, 2024, 06:02:13 pm »
The magic word you're looking for is "Sanguino" which returns a number of boards developed 12 years ago based on the 40 pin 644.

I run a fairly old 1.6.8 version of Arduino IDE and had to install this for the IDE to recognize the board type. 

I never managed to install a bootloader; really didn't put in much effort.  But you should be able to upload sketches using the AVRISP mkII by changing the Tools->Programmer menu item and using Sketch->Upload Using Programmer menu item after connecting the programmer to the SCK,MISO,MOSI,Reset,Vcc,GND pins of the 644.  If the 644 is on a breadboard, install a crystal (with 20pF caps) and 10K reset pin pullup resistor.    644 pinout here.
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3964
  • Country: nl
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #4 on: June 01, 2024, 06:36:48 pm »
There is also avrdude that can be used from command line to upload the code to the micro. The connections of the AVRISP to the ATMEGA 644P remain the same like pqass wrote. With avrdude you should be able to load the bootloader you revered to into the micro and from then on use the programming route the bootloader is made for.

Lots of info to be found on avrdude.

It is also used by the Arduino platform under the hood.

Offline MidphaseTopic starter

  • Contributor
  • Posts: 31
  • Country: us
    • KaysLABS
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #5 on: June 02, 2024, 04:48:38 am »
Thank you. Yes I'm trying to program the boot loader from the command line Terminal in MacOS and running into some problems that make me wonder if perhaps I have some incompatibility issues with the new MacOS ARM architecture. Basically it appears as if some files are not being compiled correctly and it's causing the entire boot loader writing operation to fail.
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3964
  • Country: nl
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #6 on: June 02, 2024, 05:54:32 am »
I'm not familiar with MacOS, but if it is behaving similar to Linux it might be that the AVRISP is not allowed access from user level. Under Linux it is necessary to setup udev rules to get user access to the device.

For more insight from our end you could post the error messages you get.

Offline MidphaseTopic starter

  • Contributor
  • Posts: 31
  • Country: us
    • KaysLABS
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #7 on: June 02, 2024, 07:08:51 pm »
Thank you. I'm following the instructions from this link about Building the firmware to the letter:

https://pichenettes.github.io/mutable-instruments-diy-archive/shruthi/firmware/


For one, git submodule update doesn't work for me. I tried this on two separate machines and in both cases GitHub is simply not responding. No biggie as I can clone manually -- done!

Here is the error that is being reported in Terminal:

kays@Kayss-iMac-Pro shruthi-1 % make build_all
avrlib/makefile.mk:199: build/shruthi1/depends.mk: No such file or directory
shruthi/makefile:29: build/shruthi1/depends.mk: No such file or directory
/usr/local/CrossPack-AVR-20131216/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions avrlib/adc.cc -MF build/shruthi1/adc.d -MT build/shruthi1/adc.o
make: /usr/local/CrossPack-AVR-20131216/bin/avr-g++: Bad CPU type in executable
make: *** [build/shruthi1/adc.d] Error 1


At the top of the error list, it appears that it can't find depends.mk and those files are simply not on GitHub and definitely not present in that folder. Not sure how they are generated in the first place.

Lastly, the BadCPU type error, I'm not quite sure how to solve.

I'm going to try it in Windows 11 next to see, although I'm bracing for impact on that platform since I have even less of an idea of what I'm doing on that operating system.

 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3964
  • Country: nl
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #8 on: June 02, 2024, 07:24:43 pm »
I think you are using an old version of the compiler and maybe you will have more success on windows or find an update for what you use on the Mac.

I myself work on Linux but not so much with AVR mcu's. More ARM based so different toolkit. Have used an AVR compiler on it though and not encountered this type of error. Google indicates it most likely being a MAC issue.

Check this link for more info: https://github.com/qmk/qmk_firmware/issues/14929

It looks like CrossPack-AVR is no longer supported.


Offline pqass

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: ca
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #9 on: June 02, 2024, 10:10:32 pm »
I managed to compile the project on Linux using my (old) Arduino-1.6.8 installation avr tools.  Then also with the latest 2.3.2 installation.

First download the project as a zip from the github page. Click the green "<> Code" button then "Download ZIP" item.

ALSO visit the "avrlib @ af7266e" and "tools @ 1c8c71c" folders too and download their zip files as those are links to other projects and won't be in the first zip file.

Once you've downloaded all three zip files, expand them, then replace the empty "avrlib" and "tools" folders with the content of the second and third zip files, respectively.

Download and install the Arduino IDE from here.  I was going to suggest the last version of the 1.x.x series but it doesn't look like they produced one for MacOS ARM.  So I downloaded the latest 2.3.2 (for Linux) to see where they hid the bin/avr-* tools.  Naturally, since it's a major release, they completely change the directory structure.

Once the Arduino IDE is downloaded and/or installed, run the "arduino-ide" executable itself first as that downloads the avr tools and a bunch of other stuff.  Once that's done, select an initial board from menu Tools -> Board  ...  "Arduino UNO".   Also check both boxes in File -> Preferences for "Show verbose output during ... compile, upload".  This will show you all command lines executed (with paths).  Compile the default empty sketch via Sketch -> Verify/Compile menu to confirm that everything is working/no errors.

Now change directory into your "shruthi-1-master/avrlib" subdirectory. 
Edit the makefile.mk, find the "TOOLS_PATH" and "AVRDUDE" lines, comment-out and replace with your own (confirm the new path to bin/avr-* execs as seen in the initial Arduino sketch compile above):

#AVRLIB_TOOLS_PATH ?= /usr/local/CrossPack-AVR/bin/
AVRLIB_TOOLS_PATH ?= ~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/


Since bin/avrdude exec has been moved away from the bin/avr-* stuff, skip down to ...

#AVRDUDE        = $(AVRLIB_TOOLS_PATH)avrdude
AVRDUDE        = ~/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude


Save, exit.
Now change directory back into your "shruthi-1-master/" subdirectory and type:  make
The "build/shruthi1/shruthi1.hex" file should be produced.   See below.

Code: [Select]
[xx@fedora shruthi-1-master]$ make
mkdir -p build/shruthi1/
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions avrlib/adc.cc -MF build/shruthi1/adc.d -MT build/shruthi1/adc.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions avrlib/random.cc -MF build/shruthi1/random.d -MT build/shruthi1/random.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions avrlib/serial.cc -MF build/shruthi1/serial.d -MT build/shruthi1/serial.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions avrlib/string.cc -MF build/shruthi1/string.d -MT build/shruthi1/string.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions avrlib/time.cc -MF build/shruthi1/time.d -MT build/shruthi1/time.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions avrlib/i2c/i2c.cc -MF build/shruthi1/i2c.d -MT build/shruthi1/i2c.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions avrlib/devices/wii_nunchuk.cc -MF build/shruthi1/wii_nunchuk.d -MT build/shruthi1/wii_nunchuk.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/audio_out.cc -MF build/shruthi1/audio_out.d -MT build/shruthi1/audio_out.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/clock.cc -MF build/shruthi1/clock.d -MT build/shruthi1/clock.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/display.cc -MF build/shruthi1/display.d -MT build/shruthi1/display.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/editor.cc -MF build/shruthi1/editor.d -MT build/shruthi1/editor.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/midi_dispatcher.cc -MF build/shruthi1/midi_dispatcher.d -MT build/shruthi1/midi_dispatcher.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/note_stack.cc -MF build/shruthi1/note_stack.d -MT build/shruthi1/note_stack.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/oscillator.cc -MF build/shruthi1/oscillator.d -MT build/shruthi1/oscillator.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/parameter.cc -MF build/shruthi1/parameter.d -MT build/shruthi1/parameter.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/part.cc -MF build/shruthi1/part.d -MT build/shruthi1/part.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/patch.cc -MF build/shruthi1/patch.d -MT build/shruthi1/patch.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/resources.cc -MF build/shruthi1/resources.d -MT build/shruthi1/resources.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/sequencer_settings.cc -MF build/shruthi1/sequencer_settings.d -MT build/shruthi1/sequencer_settings.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/shruthi.cc -MF build/shruthi1/shruthi.d -MT build/shruthi1/shruthi.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/storage.cc -MF build/shruthi1/storage.d -MT build/shruthi1/storage.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/system_settings.cc -MF build/shruthi1/system_settings.d -MT build/shruthi1/system_settings.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/ui.cc -MF build/shruthi1/ui.d -MT build/shruthi1/ui.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/voice_allocator.cc -MF build/shruthi1/voice_allocator.d -MT build/shruthi1/voice_allocator.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -MM -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/voice.cc -MF build/shruthi1/voice.d -MT build/shruthi1/voice.o
cat build/shruthi1/adc.d build/shruthi1/random.d build/shruthi1/serial.d build/shruthi1/string.d build/shruthi1/time.d build/shruthi1/i2c.d build/shruthi1/wii_nunchuk.d build/shruthi1/audio_out.d build/shruthi1/clock.d build/shruthi1/display.d build/shruthi1/editor.d build/shruthi1/midi_dispatcher.d build/shruthi1/note_stack.d build/shruthi1/oscillator.d build/shruthi1/parameter.d build/shruthi1/part.d build/shruthi1/patch.d build/shruthi1/resources.d build/shruthi1/sequencer_settings.d build/shruthi1/shruthi.d build/shruthi1/storage.d build/shruthi1/system_settings.d build/shruthi1/ui.d build/shruthi1/voice_allocator.d build/shruthi1/voice.d > build/shruthi1/depends.mk
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions avrlib/adc.cc -o build/shruthi1/adc.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions avrlib/random.cc -o build/shruthi1/random.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions avrlib/serial.cc -o build/shruthi1/serial.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions avrlib/string.cc -o build/shruthi1/string.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions avrlib/time.cc -o build/shruthi1/time.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions avrlib/i2c/i2c.cc -o build/shruthi1/i2c.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions avrlib/devices/wii_nunchuk.cc -o build/shruthi1/wii_nunchuk.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/audio_out.cc -o build/shruthi1/audio_out.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/clock.cc -o build/shruthi1/clock.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/display.cc -o build/shruthi1/display.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/editor.cc -o build/shruthi1/editor.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/midi_dispatcher.cc -o build/shruthi1/midi_dispatcher.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/note_stack.cc -o build/shruthi1/note_stack.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/oscillator.cc -o build/shruthi1/oscillator.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/parameter.cc -o build/shruthi1/parameter.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/part.cc -o build/shruthi1/part.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/patch.cc -o build/shruthi1/patch.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/resources.cc -o build/shruthi1/resources.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/sequencer_settings.cc -o build/shruthi1/sequencer_settings.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/shruthi.cc -o build/shruthi1/shruthi.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/storage.cc -o build/shruthi1/storage.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/system_settings.cc -o build/shruthi1/system_settings.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/ui.cc -o build/shruthi1/ui.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/voice_allocator.cc -o build/shruthi1/voice_allocator.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/voice.cc -o build/shruthi1/voice.o
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc -mmcu=atmega644p -lm -Os -Wl,--gc-sections -o build/shruthi1/shruthi1.elf build/shruthi1/adc.o build/shruthi1/random.o build/shruthi1/serial.o build/shruthi1/string.o build/shruthi1/time.o build/shruthi1/i2c.o build/shruthi1/wii_nunchuk.o build/shruthi1/audio_out.o build/shruthi1/clock.o build/shruthi1/display.o build/shruthi1/editor.o build/shruthi1/midi_dispatcher.o build/shruthi1/note_stack.o build/shruthi1/oscillator.o build/shruthi1/parameter.o build/shruthi1/part.o build/shruthi1/patch.o build/shruthi1/resources.o build/shruthi1/sequencer_settings.o build/shruthi1/shruthi.o build/shruthi1/storage.o build/shruthi1/system_settings.o build/shruthi1/ui.o build/shruthi1/voice_allocator.o build/shruthi1/voice.o  -lc
~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy -O ihex -R .eeprom build/shruthi1/shruthi1.elf build/shruthi1/shruthi1.hex


[xx@fedora shruthi-1-master]$ ls -lt build/shruthi1/
total 2972
-rw-r--r--. 1 xx xx 174360 Jun  2 17:48 shruthi1.hex
-rwxr-xr-x. 1 xx xx 792944 Jun  2 17:48 shruthi1.elf
-rw-r--r--. 1 xx xx 178620 Jun  2 17:48 voice.o
-rw-r--r--. 1 xx xx  10616 Jun  2 17:48 voice_allocator.o
-rw-r--r--. 1 xx xx 238716 Jun  2 17:48 ui.o
...

« Last Edit: June 02, 2024, 10:27:36 pm by pqass »
 
The following users thanked this post: pcprogrammer

Offline MidphaseTopic starter

  • Contributor
  • Posts: 31
  • Country: us
    • KaysLABS
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #10 on: June 03, 2024, 12:18:03 am »
THANK YOU!!!  This was incredibly helpful. I narrowed down what I was missing in the fact that I had not specified the AVRDUDE location in the variable, once I did that I was also able to compile both the bootloader and the firmware.

Now I'm running into another issue, when I try to install the bootloader into the AtMega644p, I get the following error:

kays@Kayss-MacBook-Air shruthi-1 % make bake_all
make -f bootloader/makefile fuses
~/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude -V -p m644p -c avrispmkII -P usb -B 10 -e -u \
         -U efuse:w:0xfd:m \
         -U hfuse:w:0xd6:m \
         -U lfuse:w:0xff:m \
         -U lock:w:0x2f:m
avrdude: can't open config file "/Users/jenkins/jenkins/workspace/avrdude-staging/label/mac-mini/objdir/etc/avrdude.conf": No such file or directory
avrdude: error reading system wide configuration file "/Users/jenkins/jenkins/workspace/avrdude-staging/label/mac-mini/objdir/etc/avrdude.conf"
make[1]: *** [fuses] Error 1
make: *** [bake_all] Error 2


It would appear as if the AVRDUDE config file is being pointed to the wrong directory. The problem is that I'm not sure how to go about changing the location of the config file that AVRDUDE is looking for. I tried looking in various files in the Shruthi folder, and the makefile.mk but there appears to be no reference to that variable.

Any idea how I could go about changing that variable?

Many thanks again, I feel as if I'm making some real progress finally!
 

Offline pqass

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: ca
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #11 on: June 03, 2024, 12:46:11 am »
That could be a default path.  None of the project makefiles try to specify any avrdude.conf file.

Try editing the avrlib/makefile.mk, looking for "AVRDUDE_COM_OPTS", commenting it out, then adding the following:

#AVRDUDE_COM_OPTS = -V -p $(DMCU)
AVRDUDE_COM_OPTS = -V -p $(DMCU)  -C ~/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf
« Last Edit: June 03, 2024, 12:49:51 am by pqass »
 

Offline MidphaseTopic starter

  • Contributor
  • Posts: 31
  • Country: us
    • KaysLABS
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #12 on: June 03, 2024, 01:10:40 am »
Thank you again, very spot on. That seems to have done the trick (I think)!

I believe I was able to successfully write to the Atmega644p...but now the synth doesn't appear to be doing anything (the screen is completely blank).

One of the things I had noticed was this mention:

"Make sure your avr-gcc is as close as possible to 4.3.3 since the most recent versions of gcc are performing optimizations differently and can cause the firmware to grow out of the size constraints."

How can I check to see what version of the GCC I am utilizing? And if so, how do I change it since the Arduino IDE installs them for me?

Many thanks!
 

Offline pqass

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: ca
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #13 on: June 03, 2024, 03:05:38 am »
I believe I was able to successfully write to the Atmega644p...but now the synth doesn't appear to be doing anything (the screen is completely blank).

One of the things I had noticed was this mention:

"Make sure your avr-gcc is as close as possible to 4.3.3 since the most recent versions of gcc are performing optimizations differently and can cause the firmware to grow out of the size constraints."

How can I check to see what version of the GCC I am utilizing? And if so, how do I change it since the Arduino IDE installs them for me?

Many thanks!

~/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc -v

The above returns "gcc version 7.3.0 (GCC)" for me which matches the dir path.
But given how old the project is, avr-gcc has progressed.  You can't change what the Arduino IDE installs as that's what they'll support.  You'd have to dig-up some old avr binaries somewhere or compile your own from old sources.

For some unknown reason, the bootloader/bootloader.cc didn't compile for me so I compiled it manually using:

Code: [Select]
avr-g++ -MM -mmcu=atmega644p -I. -Os -w -Wall -DF_CPU=20000000 ...snip...  bootloader/bootloader.cc -MF build/shruthi1/bootloader.d -MT build/shruthi1/bootloader.o
avr-g++ -c -mmcu=atmega644p -I. -Os -w -Wall -DF_CPU=20000000 ...snip... bootloader/bootloader.cc -o build/shruthi1/bootloader.o
avr-gcc -mmcu=atmega644p -lm -Os -Wl,--gc-sections -o build/shruthi1/bootloader.elf build/shruthi1/bootloader.o
avr-objcopy -O ihex build/shruthi1/bootloader.elf build/shruthi1/bootloader.hex

Then looking at both hex files produced:

Code: [Select]
[xx@fedora shruthi-1-master]$ tail  build/shruthi1/shruthi1.hex
:10F19C002F42B442783FF63F0000354135410D3BDC
:10F1AC00163E000077417741E03E303E0000DE41E4
:10F1BC00DE41AD3EF13D000061436143783FE645E1
:10F1CC004B4646444644AC3AA43AFD3C8244B442D5
:10F1DC00E940F940E6400505135B135A12591158E2
:10F1EC0010570F560E550D540C5312590B520A5101
:10F1FC000950084F074E064D1259054C054C054C4D
:10F20C00044B034A02491259C348C347C2468246BB
:06F21C0083063F053D05DD
:00000001FF
[xx@fedora shruthi-1-master]$ tail  build/shruthi1/bootloader.hex
:10038000920090E080E0DF91CF9108952F923F920C
:100390004F925F926F927F928F929F92AF92BF9295
:1003A000CF92DF92EF92FF920F931F93CF93DF9341
:1003B000CDB7DEB7CA1BDB0B0FB6F894DEBF0FBE9E
:1003C000CDBF09942A88398848885F846E847D84EB
:1003D0008C849B84AA84B984C884DF80EE80FD80ED
:1003E0000C811B81AA81B981CE0FD11D0FB6F89463
:0E03F000DEBF0FBECDBFED010895F894FFCF24
:0C03FE00F00021020002F0002077000255
:00000001FF

You'll see the last byte of the app is at 0xF21C + 0x6 bytes or 0xF222.  This is under 64k; the limit for the atmega644 by 0x0DDE or 3550 bytes.  This is good.

However, WRT the 2nd hex, the bootloader, i probably compiled it wrong since addressing starts at 0x0000 to 0x03F0+0xE bytes. Although it's under 1024 bytes or 512 words as specified by BOOTSZ=11 of HFUSE=D6 (see bootloader/makefile), I was expecting it to start at 0xFC00 like my optiboot_atmega644_8m.hex bootloader (which I happened to finally upload to my 644 earlier today).  Also on the 2nd-last line it's re-writing the previous line from 0x03FE+0xC bytes which puts it over the 1024 byte block.  I'm not sure what's happening here.

Can you upload your bootloader.hex or it may be called muboot.hex.

I'm just trying to confirm that there is enough space for the bootloader at the end of the address space.



EDIT:  Nevermind, I figured out how to compile the bootloader via its makefile:
Code: [Select]
[xx@fedora shruthi-1-master]$ make -f bootloader/makefile

The hex looks better too.  It does start at location 0xFC00 as expected and it does not exceed the 1024 byte block (0xFFDE + 0xC = 0xFFEA).   FYI: Intel HEX format description here.
Code: [Select]
[xx@fedora shruthi-1-master]$ tail build/muboot/muboot.hex
:10FF70004F925F926F927F928F929F92AF92BF92B9
:10FF8000CF92DF92EF92FF920F931F93CF93DF9365
:10FF9000CDB7DEB7CA1BDB0B0FB6F894DEBF0FBEC2
:10FFA000CDBF09942A88398848885F846E847D840F
:10FFB0008C849B84AA84B984C884DF80EE80FD8011
:10FFC0000C811B81AA81B981CE0FD11D0FB6F89487
:0EFFD000DEBF0FBECDBFED010895F894FFCF48
:0CFFDE00F00021020002F0002077000279
:040000030000FC00FD
:00000001FF

In conclusion,
the app code doesn't overlap the bootloader.  And the bootloader appears to be in the correct spot (within its 1024 byte block).
It must be some other reason the device isn't booting.
« Last Edit: June 03, 2024, 05:50:04 am by pqass »
 

Offline MidphaseTopic starter

  • Contributor
  • Posts: 31
  • Country: us
    • KaysLABS
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #14 on: June 03, 2024, 06:00:20 am »
Sure thing, here are the two .hex files that the compiler produced for me.


How would I know if there is something wrong with the ATmega644p? If I had damaged it somehow, would it have given me an error during the writing process?
« Last Edit: June 03, 2024, 06:09:40 am by Midphase »
 

Offline pqass

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: ca
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #15 on: June 03, 2024, 06:36:11 am »
Your files start and end on the same addresses just like my files.
There is no overlap so that rules out the issue with later avr-gcc versions growing the code beyond the limits.

The way I usually test is to install the Arduino blink example on a breadboarded chip with LED.
But that's probably a pain for you to do that.

Maybe you didn't see an error during the upload step?
Add the "-v" at the end of the avrlib/makefile.mk "AVRDUDE_COM_OPTS" and try to upload again:

AVRDUDE_COM_OPTS = -V -p $(DMCU)  -C ~/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf -v
 

Offline electronix27

  • Contributor
  • Posts: 11
  • Country: us
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #16 on: June 03, 2024, 10:59:43 am »
Hi
Maybe you have already figured out your situation.  I have been using a Mac to compile and flash numerous Atmel chips through the years with all the tool chain directly installed to the machine, using terminal.  I've never used the Arduino IDE.  My last project I used a Atmega 324PA and it's from the same family of chips as yours, just less flash memory and EEprom.  I have older machines that I use CrossPack-AVR installer on, but it contains 32 bit tools which apple stopped supporting since Catalina.  I've never used an M series Mac, only intel.  The last time I had to install all the tools manually using the brew command.  You also need Apple command line tools to use make file in terminal, which either you already do or compiling through Arduino set up already makes that possible.

Looking at your configuration settings (fuses), some things don't look right.  For instance lfuse = FF, which means no clock source is defined.  Take a look at this fuse calculator -- https://eleccelerator.com/fusecalc/fusecalc.php?chip=atmega644p.

You could also try flashing the chip directly with avrdude, for you be something like

avrdude -c avrisp mkII -p atmega644 -U flash:w:[your hex].hex

you would need to have the .hex in the directory your terminal is linked to.
« Last Edit: June 03, 2024, 11:09:03 am by electronix27 »
 

Offline MidphaseTopic starter

  • Contributor
  • Posts: 31
  • Country: us
    • KaysLABS
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #17 on: June 03, 2024, 05:23:44 pm »
The way I usually test is to install the Arduino blink example on a breadboarded chip with LED.
But that's probably a pain for you to do that.

Maybe you didn't see an error during the upload step?
Add the "-v" at the end of the avrlib/makefile.mk "AVRDUDE_COM_OPTS" and try to upload again:

Thank you. I can probably set up the blink test as well since I have the breadboard and components. In this case I'm a bit worried about all of the many variables involved in this particular project (i.e. both assembling a new PCB with various components, as well as learning to program this microcontroller, and hope everything is 100% ok).

I'll give it another shot today from scratch and see. I also do have another "virgin" ATMega644p that I could also use.
 

Offline MidphaseTopic starter

  • Contributor
  • Posts: 31
  • Country: us
    • KaysLABS
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #18 on: June 03, 2024, 05:27:42 pm »
You could also try flashing the chip directly with avrdude, for you be something like

avrdude -c avrisp mkII -p atmega644 -U flash:w:[your hex].hex

you would need to have the .hex in the directory your terminal is linked to.

Thank you. Alternatively I also have a Windows machine that I can use for this. As a matter of fact I have this AVRDUDE GUI app that I downloaded which seems to make uploading the files a bit more straightforward.

One of the things I don't really understand is the Fuses and their function. I'm used to the term as it applies to electronics, so I worry that I'm going to burn something out if they're set up incorrectly. In this case, I have to assume that the guy who designed this device knew what he was doing as far as the fuse settings, but I am not 100% sure.
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3964
  • Country: nl
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #19 on: June 03, 2024, 06:11:03 pm »
The "fuse" settings in an ATMEGA644P are there to allow several options like protection against read back of the FLASH to safeguard your intellectual property. They are similar to EEPROM bits and can be reset for as far as I know.

Most of the time there is no need to touch the "fuses", but to learn about them the best source is the datasheet or the reference manual for the MCU in question. https://ww1.microchip.com/downloads/en/DeviceDoc/doc2593.pdf

An exception is the clock source. See page 28.

On page 273 there is something about the bootloader and a related fuse.

Chapter 25.2 has information about the fuses. (Page 285+)

Offline pqass

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: ca
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #20 on: June 03, 2024, 06:41:37 pm »
Before you pull the chip from the PCB, maybe you can just try reading the fuses.  FYI: schematics here.
Connect your AVRISP mkII 6 pin ISP header to the shruthi PCB, power up and execute the following:

Code: [Select]
~/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino14/bin/avrdude -C ~/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino14/etc/avrdude.conf -v -p atmega644p -c stk500v2 -P usb
It should either return info or an error.



Why "-c stk500v2" and "-p atmega644p"?   
A:You can specify "-c ?" or "-p ?" and avrdude will return a list. 
When I selected "AVRISP mkII" in Tools->Programmer IDE menu, that's what it put on the command line when I exec'd Sketch->Upload Using Programmer.
« Last Edit: June 03, 2024, 07:46:42 pm by pqass »
 
The following users thanked this post: Midphase

Offline electronix27

  • Contributor
  • Posts: 11
  • Country: us
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #21 on: June 03, 2024, 07:07:21 pm »


The schematic shows a 20 Mhz crystal on xtal 1 (pin 13) & xtal 2 (pin 12).  low fuse of FF would not read this properly.
« Last Edit: June 03, 2024, 07:14:29 pm by electronix27 »
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3282
  • Country: gb
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #22 on: June 03, 2024, 07:16:08 pm »
One thing I haven't seen anyone mention; since you are programming the bootloader and application in two separate operations you will need to perform a flash erase only for the first programming operation and not the second.  If you are using AVRDude, the -e option enables flash+EEPROM erase.

The other option is to combine the hex files so you only perform a single programming operation.
 

Offline pqass

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: ca
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #23 on: June 03, 2024, 07:19:36 pm »
One of the things I don't really understand is the Fuses and their function. I'm used to the term as it applies to electronics, so I worry that I'm going to burn something out if they're set up incorrectly. In this case, I have to assume that the guy who designed this device knew what he was doing as far as the fuse settings, but I am not 100% sure.

See this fuse calculator configured with the settings for your application (according to avrlib/makefile).

The danger bits are the HFUSE:SPIEN (must always be checked) otherwise you lose the ability to upload code via SPI pins.  And you'll need what's called a "high voltage programmer" to recover.

The whole LOCKBIT column could screw you out of being able to update the flash. It's used when installing the bootloader code and when you install your final app code version so that it's protected from recovery. 

I've always left this to the Arduino IDE to install a bootloader; never fiddled with it directly.  But after I installed the bootloader yesterday via IDE, I noticed that it executed avrdude twice.
First with: "-e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xFF:m",      <== erase, unlock bootloader and my choice of fuses.
Then a second time with: "-Uflash:w:<path>/optiboot_atmega644_8m.hex:i -Ulock:w:0x0F:m"  <== update bootloader code and lock-down.

Notice how the lower lock nibble is always F.  I think it would be best to never change that.

I tried reading about "24. Boot Loader Support ... Self-Programming" and "25. Memory Programming".  My brain hurt.
« Last Edit: June 03, 2024, 08:14:14 pm by pqass »
 

Offline pqass

  • Frequent Contributor
  • **
  • Posts: 833
  • Country: ca
Re: ATMEGA 644P AVR Programming Help Needed
« Reply #24 on: June 03, 2024, 07:30:35 pm »


The schematic shows a 20 Mhz crystal on xtal 1 (pin 13) & xtal 2 (pin 12).  low fuse of FF would not read this properly.

This is incorrect. LFUSE=FF means:
no clock out on the CLKO pin 2 (used to distribute clock or monitor freq. to adjust an internal tweak register),
no internal clock divide by 8,
external xtal oscillator 8MHz or greater, slowest startup delay.


BTW @electronix27, thanks for the link to your fuse calculator. It's better than the one I was using.
« Last Edit: June 03, 2024, 08:21:55 pm by pqass »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf