geekhack

geekhack Community => Keyboards => Topic started by: G_I_B_B_O_N on Mon, 11 June 2018, 05:53:48

Title: Atreus firmware help (TMK flipping layout)
Post by: G_I_B_B_O_N on Mon, 11 June 2018, 05:53:48
Can anyone help me compiling my Atreus firmware? I've run into an issue where no matter what I do it compiles the layout flipped horizontally.

first of all, uploading the pre-compiled firmware works fine using this command:

avrdude -p atmega32u4 -c avr109 -U flash:w:atreus-qwerty.hex -P /dev/ttyACM0

I'd like to compile and upload the 'qwerty_classic' TMK firmware, but all attempts have lead to a horizontally flipped layout. Here's commands I've tried:

make upload KEYMAP=qwerty_classic USB=/dev/ttyACM0
OPT_DEFS=-DPCBDOWN make upload KEYMAP=qwerty_classic USB=/dev/ttyACM0
OPT_DEFS=-PCBFLIP make upload KEYMAP=qwerty USB=/dev/ttyACM0
OPT_DEFS=-SWAPCOLUMNS make upload KEYMAP=qwerty_classic USB=/dev/ttyACM0

All of these lead to the same layout which is flipped horizontally from what it should be.

I've also attached a txt file with my terminal output when I compile using:
make upload KEYMAP=qwerty_classic USB=/dev/ttyACM0

I'm not a very experienced programmer, but I do know some C. I have less of an idea what i'm doing in the terminal though. Any help is much appreciated.
Title: Re: Atreus firmware help (TMK flipping layout)
Post by: suicidal_orange on Mon, 11 June 2018, 06:30:21
Just a thought - are you sure you soldered the switches on the right side of the board?  Looking on the Atreus website I see the switch outlines on the back which is unusual, and the switches can go either way as there are two sets of holes...

There maybe outlines on both sides of the board but that was my first thought.


Seems there are clever options for this board, I'll go back to sleep.
Title: Re: Atreus firmware help (TMK flipping layout)
Post by: JianYang on Mon, 11 June 2018, 06:38:06
Can anyone help me compiling my Atreus firmware? I've run into an issue where no matter what I do it compiles the layout flipped horizontally.

first of all, uploading the pre-compiled firmware works fine using this command:

avrdude -p atmega32u4 -c avr109 -U flash:w:atreus-qwerty.hex -P /dev/ttyACM0

I'd like to compile and upload the 'qwerty_classic' TMK firmware, but all attempts have lead to a horizontally flipped layout. Here's commands I've tried:

make upload KEYMAP=qwerty_classic USB=/dev/ttyACM0
OPT_DEFS=-DPCBDOWN make upload KEYMAP=qwerty_classic USB=/dev/ttyACM0
OPT_DEFS=-PCBFLIP make upload KEYMAP=qwerty USB=/dev/ttyACM0
OPT_DEFS=-SWAPCOLUMNS make upload KEYMAP=qwerty_classic USB=/dev/ttyACM0

All of these lead to the same layout which is flipped horizontally from what it should be.

I've also attached a txt file with my terminal output when I compile using:
make upload KEYMAP=qwerty_classic USB=/dev/ttyACM0

I'm not a very experienced programmer, but I do know some C. I have less of an idea what i'm doing in the terminal though. Any help is much appreciated.


If you change opts, you have to make clean before, otherwise the compiler won't really recompile anything (as the source files are all older than the obj files). But the PCBUP and PCBDOWN are the correct flags, but I am not sure which is the right one for you. You can edit keymap_common.h (I think) and remove the alternate case and only leave the define for KEYMAP_PCBUP/PCBDOWN and make sure it maps to KEYMAP (IIRC).
Title: Re: Atreus firmware help (TMK flipping layout)
Post by: G_I_B_B_O_N on Mon, 11 June 2018, 13:59:20
If you change opts, you have to make clean before, otherwise the compiler won't really recompile anything (as the source files are all older than the obj files). But the PCBUP and PCBDOWN are the correct flags, but I am not sure which is the right one for you. You can edit keymap_common.h (I think) and remove the alternate case and only leave the define for KEYMAP_PCBUP/PCBDOWN and make sure it maps to KEYMAP (IIRC).

I'm not sure I understand what yo mean by make clean. Does this mean a hard reset? I resaved the desired layout file and the relevant headers in hopes they would cause a recompile.
I just saw this in the firmware readme. I'm gonna try this now.
Title: Re: Atreus firmware help (TMK flipping layout)
Post by: G_I_B_B_O_N on Mon, 11 June 2018, 14:24:20
I tried 'make clean' followed each time by each of the previous upload options I listed before. No go. The thing will not map the layout facing forward.

Just a thought - are you sure you soldered the switches on the right side of the board?  Looking on the Atreus website I see the switch outlines on the back which is unusual, and the switches can go either way as there are two sets of holes...

Even if I soldered it upside down, these upload options should correct that right? Also, if it was upside down, why would the precompiled firmware work fine out of the box?

Is there a way to compile the layout into a .hex file like the precompiled ones on the website and upload using:

avrdude -p atmega32u4 -c avr109 -U flash:w:atreus_classic.hex -P /dev/ttyACM0

- this seems to be the only upload method that maps correctly (using the pre-compiled firmware)
Title: Re: Atreus firmware help (TMK flipping layout)
Post by: G_I_B_B_O_N on Mon, 11 June 2018, 15:14:12
Ok I tried compiling to a hex file and then uploading using:

avrdude -p atmega32u4 -c avr109 -U flash:w:atreus.hex -P /path/to/usb

I'm pretty sure now that the thing is compiling it backwards because the standard pre-compiled file from the atreus website works fine but all my compiles are flipped. Even after I use 'make clean' followed by all the available options to flip the layout during compile, it never changes.

Any suggestions?
Title: Re: Atreus firmware help (TMK flipping layout)
Post by: Tactile on Mon, 11 June 2018, 15:14:19
In the sample output file you've linked in the OP I don't see any reference to "atreus-qwerty.hex". Is the flash operation targeting the wrong file?

Code: [Select]
Creating load file for Flash: atreus.hex
avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature atreus.elf atreus.hex
...
avrdude: erasing chip
avrdude: reading input file "atreus.hex"
avrdude: input file atreus.hex auto detected as Intel Hex
avrdude: writing flash (14836 bytes):
Title: Re: Atreus firmware help (TMK flipping layout)
Post by: G_I_B_B_O_N on Mon, 11 June 2018, 15:29:17
In the sample output file you've linked in the OP I don't see any reference to "atreus-qwerty.hex". Is the flash operation targeting the wrong file?

Sorry, that output file was from using Make. It compiles it to atreus.hex and then uploads that.

The precompiled file from the website was called atreus-qwerty.hex and it's just uploaded using:
avrdude -p atmega32u4 -c avr109 -U flash:w:atreus-qwerty.hex -P /dev/ttyACM0

That works fine, but as it's precompiled, I'm unable to modify my layout at all.