Flashlight Firmware Repository

There all in same folder. Those are at the top of momentary.c file.

Are they all in the same folder? Like this:

Very close

I am going to start over.

From here

http://bazaar.launchpad.net/~toykeeper/flashlight-firmware/trunk/files/head:/ToyKeeper/spaghetti-monster/

I downloaded “momentary.c” and all the files not in a folder below it into one folder.

Is there somewhere else I need to get files?

You also need the files here:
http://bazaar.launchpad.net/~toykeeper/flashlight-firmware/trunk/files/head:/ToyKeeper

Ok, got everything not in a folder.

15 Errors. pgmspace.h unknown type name uint_farptr_t

Do you also have all of the libraries needed to compile code for Atmel devices? I use Atmel studio and it all comes with it.

All I do is download all of the files from the spaghetti monster folder, the root Toykeeper directory and the ui directory, I use Anduril for this. Stick all of these in the folder Atmel studio creates for my project. Paste the contents of Anduril.c into the main.c then define Attiny and it compiles just fine.

It looks like you might be missing some libraries unrelated to FSM?

I am using Code::Blocks. I have also tried from the command line “gcc-avr”.

You have gotten me down to 15 errors all related. I think you are right I am missing something not FSM .

FYI: I’m taking a short look at why that doesn’t work for you. I suspect that Code::Blocks is not using avr-gcc…

Part 1: Command Line. You have to use the same commands as listed in bin/build.sh

C:\Users\Thomas\Documents\flashlight-firmware-fsm\ToyKeeper\spaghetti-monster\momentary>"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-g++.exe" -Wall -g -Os -mmcu=attiny85 -c -std=gnu99 -DATTINY=85 -I.. -I../.. -I../../.. -fshort-enums -o momentary.o -c momentary.c
cc1plus.exe: warning: command line option '-std=gnu99' is valid for C/ObjC but not for C++ 
 C:\Users\Thomas\Documents\flashlight-firmware-fsm\ToyKeeper\spaghetti-monster\momentary>"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-g++.exe" -Wall -g -Os -mmcu=attiny85 -o momentary.elf momentary.o 
 C:\Users\Thomas\Documents\flashlight-firmware-fsm\ToyKeeper\spaghetti-monster\momentary>"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex momentary.elf momentary.hex 
 C:\Users\Thomas\Documents\flashlight-firmware-fsm\ToyKeeper\spaghetti-monster\momentary>"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-size.exe" -C --mcu=attiny85 momentary.elf
AVR Memory Usage
----------------
Device: attiny85 
 Program: 2018 bytes (24.6% Full)
(.text + .data + .bootloader) 
 Data: 144 bytes (28.1% Full)
(.data + .bss + .noinit)

In Code::Blocks Setting-compiler-toolchain executables-program files - avr-gcc

but there are other choices in the program files submenu

At the start of a new project I have selected GNU GCC Compiler for AVR

Now I had a look and I have to admit: If I have a decision between having to work with codeblocks or getting a swift kick in the nuts, I’m choosing the kick.
That tool is NOT user-friendly or easy to use.

I modified the linux build-85.sh script for windows: https://zeroflow.at/flashlight/build-85-momentary.bat
Download it, have a look at it to see it’s not malicious and then place it in the momentary folder and run it.

As long as you have the avr-gcc folder in your system path, it will find it by default.
If not, update the values of CC, OBJCOPY and avr-size to use the full path.

Maybe you can use the commands you see in the batch file to find out how to configure code::blocks

I am using Ubuntu

Even better. Download the bin folder from the root and use “build-85.sh momentary” while you are in the folder of the momentary project.

Look at the other build-all.sh to get a reference.

I have got it to compile using the command line method.

And flashed it onto a loose attiny85

avr-gcc -Wall -g -Os -mmcu=attiny85 -o momentary.bin momentary.c
then
avr-size -C momentary.bin
then
avr-objcopy -j .text -j .data -O ihex momentary.bin momentary.hex
then
avrdude -p attiny85 -c usbasp -U flash:w:momentary.hex:i -F -P usb

That’s good news.
For later builds, you want to include arguments like -Os and -fshort-enums to save space and -Wall to get more warnings.

I found the easiest method is to use a virtual machine with linux installed (mint is my preferred flavor right now) and then follow TK’s instructions on how to setup and build the firmware. It just works without all the hassle.

Plus I can save the virtual machine state with everything open and ready to use, which actually helps keep track of the firmware.

I prefer the WSL (Linux subsystem for Windows) where I get a simple Ubuntu shell on my PC

I have heard it works but I have all the windows store and other tracking features disabled. removed, deleted, and annihilated from my systems, at least as much as you can do without messing up the basic functionality. so I can’t use it.

Everytime I use a full fat version of windows 10 I get creeped out in a major way.

Yeah, I feel pretty bad about using that non-free spying bullshit. But gaming keeps me from switching to a free OS based on GNU/Linux.