Flashlight Firmware Repository

2379 posts / 0 new
Last post
SammysHP
SammysHP's picture
Offline
Last seen: 9 hours 43 min ago
Joined: 06/25/2019 - 14:35
Posts: 1816
Location: Germany

Breezy is a modern fork/replacement of bazaar and works fine with the latest version of Python 3.

You can try my own Docker image for building the firmware. It should include everything to build all versions of Anduril.

https://budgetlightforum.com/node/82480

thefreeman
thefreeman's picture
Offline
Last seen: 2 hours 15 min ago
Joined: 01/06/2020 - 09:56
Posts: 1817
Location: France

The T1616 DFP error message should point to a readme in /bin IIRC, where there are instructions for installing it (downloading and pointing to its path in build.sh or something).

swhs
Offline
Last seen: 3 weeks 2 days ago
Joined: 04/01/2020 - 07:51
Posts: 85

I use FreeBSD for development and I downloaded the firmware repository:

1. https://code.launchpad.net/~toykeeper/flashlight-firmware/anduril2

bzr which I used on FreeBSD 13.0 to download an older snapshot is longer supported on FreeBSD 13.1. brz is available as a port/pkg but I didn’t need it after all as despite the comment above of the download on launchpad not working, I just tried it and it did work:

2. click “Browse the code”, then “view revision”, then “download tarball”.

Then install software:

3 pkg install avr-gcc

4 pkg install avr-libc
This uses avr-libc 2.0.0 so I later modified the port to compile 2.1.0

5 for linuxisms (bash): ln -s /usr/local/bin/bash /bin/bash

6. The README in the zip says to download an Atmel pack for newer attiny1 series (needed as I wanted to change the firmware in the latest version of the SC31pro).

http://packs.download.atmel.com/

and use the environment variable as stated in the README

7. Compiling.
I had already tried to compile for example ‘crescendo’ before downloading the Atmel pack and before updating avr-libc and that worked fine.

===
The 2 pocket lamps I want to reprogram are, with version/type identifier if I counted correctly:

- SC31pro, version check says: 2022 02 08 (then not a zero but a long pause, I guess this is a change in later anduril versions to not give leading zeroes but a long pause) 614 [ From the table of models/firmwares: 614 = sofirn-sp36-t1616 attiny1616, is that correct? ]

- D4V2 219b sw45k + boost driver: 2021 11 12 0273 [ 0273 = noctigon-dm11-12v attiny1634, is that correct? ]

===
I tried hello_world and which gave errors, the inline functions are not recognized or not treated correctly by the compiler it seems:

JonnyC/STAR/STAR:
avr-gcc -Wall -g -Os -mmcu=attiny13 -o STAR STAR.c

/usr/local/lib/gcc/avr/11.2.0/../../../../avr/bin/ld: /tmp//ccOwF4CX.o: in function `main’:
anduril2-r653/JonnyC/STAR/STAR/STAR.c:(.text.startup+0×8): undefined reference to `ADC_on’
/usr/local/lib/gcc/avr/11.2.0/../../../../avr/bin/ld: /tmp//ccOwF4CX.o: in function `__vector_8’:

etc.
Same happens in hello_world.
Removing the ‘inline’ keyword makes them compile. Weird, what could be the issue?

Then in ToyKeeper/spaghetti-monster/anduril/

‘make’ gives:
= 40 builds succeeded, 22 failed =

Some give too much code such as:

= emisar-d4s-219c =
/usr/local/lib/gcc/avr/11.2.0/../../../../avr/bin/ld: anduril.elf section `.data’ will not fit in region `text’
/usr/local/lib/gcc/avr/11.2.0/../../../../avr/bin/ld: region `text’ overflowed by 10 bytes
collect2: error: ld returned 1 exit status

then the attiny1 series give other issues:
= sofirn-sp36-t1616 =
In file included from ../fsm-standby.c:24, from ../spaghetti-monster.h:74, from anduril.c:92:
../fsm-standby.c: In function ‘sleep_until_eswitch_pressed’:
../fsm-standby.c:59:9: error: ‘MCUCR’ undeclared (first use in this function) 59 | set_sleep_mode(SLEEP_MODE_PWR_DOWN); | ^~~~~~~~~~~~~~
MCUCR looks to be defined in many header files in the Atmel pack but not for the attiny1616, unless it uses another include too which for some reason doesn’t get included.

The avr-gcc compiler version number (avr-gcc -v) is 11.2.0

Any ideas on what to do to fix this?

SammysHP
SammysHP's picture
Offline
Last seen: 9 hours 43 min ago
Joined: 06/25/2019 - 14:35
Posts: 1816
Location: Germany

swhs wrote:
I use FreeBSD for development and I downloaded the firmware repository:

1. https://code.launchpad.net/~toykeeper/flashlight-firmware/anduril2

bzr which I used on FreeBSD 13.0 to download an older snapshot is longer supported on FreeBSD 13.1. brz is available as a port/pkg but I didn’t need it after all as despite the comment above of the download on launchpad not working, I just tried it and it did work:


Have you tried this? It shows Python 3.7 to 3.9: https://www.freshports.org/devel/brz/

Then use Docker with my image to compile. Or use the latest development version of avr-libc and version 11 of avr-gcc without DFP.

swhs wrote:
- SC31pro, version check says: 2022 02 08 (then not a zero but a long pause, I guess this is a change in later anduril versions to not give leading zeroes but a long pause) 614 [ From the table of models/firmwares: 614 = sofirn-sp36-t1616 attiny1616, is that correct? ]

There shouldn’t be a pause but a very short blink. But the version and model sounds right.

swhs wrote:
- D4V2 219b sw45k + boost driver: 2021 11 12 0273 [ 0273 = noctigon-dm11-12v attiny1634, is that correct? ]

If it’s what version check says… Emisar/Noctigon got very confusing with their driver and host combinations.

swhs wrote:
I tried hello_world and which gave errors, the inline functions are not recognized or not treated correctly by the compiler it seems:

JonnyC/STAR/STAR:
avr-gcc -Wall -g -Os -mmcu=attiny13 -o STAR STAR.c

/usr/local/lib/gcc/avr/11.2.0/../../../../avr/bin/ld: /tmp//ccOwF4CX.o: in function `main’:
anduril2-r653/JonnyC/STAR/STAR/STAR.c:(.text.startup+0×8): undefined reference to `ADC_on’
/usr/local/lib/gcc/avr/11.2.0/../../../../avr/bin/ld: /tmp//ccOwF4CX.o: in function `__vector_8’:

etc.
Same happens in hello_world.
Removing the ‘inline’ keyword makes them compile. Weird, what could be the issue?


That example is not maintained anymore. Only Anduril/FSM is maintained.

swhs wrote:
Then in ToyKeeper/spaghetti-monster/anduril/

‘make’ gives:
= 40 builds succeeded, 22 failed =

Some give too much code such as:

= emisar-d4s-219c =
/usr/local/lib/gcc/avr/11.2.0/../../../../avr/bin/ld: anduril.elf section `.data’ will not fit in region `text’
/usr/local/lib/gcc/avr/11.2.0/../../../../avr/bin/ld: region `text’ overflowed by 10 bytes
collect2: error: ld returned 1 exit status


avr-gcc 11 will create larger files than version 10 and it won’t fit.

swhs wrote:
then the attiny1 series give other issues:
= sofirn-sp36-t1616 =
In file included from ../fsm-standby.c:24, from ../spaghetti-monster.h:74, from anduril.c:92:
../fsm-standby.c: In function ‘sleep_until_eswitch_pressed’:
../fsm-standby.c:59:9: error: ‘MCUCR’ undeclared (first use in this function) 59 | set_sleep_mode(SLEEP_MODE_PWR_DOWN); | ^~~~~~~~~~~~~~
MCUCR looks to be defined in many header files in the Atmel pack but not for the attiny1616, unless it uses another include too which for some reason doesn’t get included.

That is an incompatibility between avr-libc and the DFP. Just use the latest development build of avr-libc without DFP (or my docker image).
swhs
Offline
Last seen: 3 weeks 2 days ago
Joined: 04/01/2020 - 07:51
Posts: 85

SammysHP wrote:

Have you tried this? It shows Python 3.7 to 3.9: https://www.freshports.org/devel/brz/

Then use Docker with my image to compile. Or use the latest development version of avr-libc and version 11 of avr-gcc without DFP.

There is a port of brz so I could use that but as downloading tarball works I skipped it.

I will have a look at your docker files and devel versions of avr-libc.

SammysHP wrote:
swhs wrote:
- SC31pro, version check says: 2022 02 08 (then not a zero but a long pause, I guess this is a change in later anduril versions to not give leading zeroes but a long pause) 614 [ From the table of models/firmwares: 614 = sofirn-sp36-t1616 attiny1616, is that correct? ]
There shouldn’t be a pause but a very short blink. But the version and model sounds right.

Definitely no zero, but instead a pause. I made a video of the output of both lamps so I could check the counting, without having to go into version check multiple times to be sure. I had a look again, no zero…

SammysHP wrote:

swhs wrote:
I tried hello_world and which gave errors, the inline functions are not recognized or not treated correctly by the compiler it seems:

JonnyC/STAR/STAR:
avr-gcc -Wall -g -Os -mmcu=attiny13 -o STAR STAR.c

/usr/local/lib/gcc/avr/11.2.0/../../../../avr/bin/ld: /tmp//ccOwF4CX.o: in function `main’:
anduril2-r653/JonnyC/STAR/STAR/STAR.c:(.text.startup+0×8): undefined reference to `ADC_on’
/usr/local/lib/gcc/avr/11.2.0/../../../../avr/bin/ld: /tmp//ccOwF4CX.o: in function `__vector_8’:

etc.
Same happens in hello_world.
Removing the ‘inline’ keyword makes them compile. Weird, what could be the issue?


That example is not maintained anymore. Only Anduril/FSM is maintained.

Yes, but it should compile or not? Is ‘inline’ no longer working correctly? Seems weird.

SammysHP
SammysHP's picture
Offline
Last seen: 9 hours 43 min ago
Joined: 06/25/2019 - 14:35
Posts: 1816
Location: Germany

swhs wrote:
Yes, but it should compile or not? Is ‘inline’ no longer working correctly? Seems weird.

Different compiler version and language version. You can make it ‘static inline’. inline on its own was never really a good idea.
swhs
Offline
Last seen: 3 weeks 2 days ago
Joined: 04/01/2020 - 07:51
Posts: 85

SammysHP wrote:
swhs wrote:
I use FreeBSD for development and I downloaded the firmware repository:

1. https://code.launchpad.net/~toykeeper/flashlight-firmware/anduril2

bzr which I used on FreeBSD 13.0 to download an older snapshot is longer supported on FreeBSD 13.1. brz is available as a port/pkg but I didn’t need it after all as despite the comment above of the download on launchpad not working, I just tried it and it did work:


Have you tried this? It shows Python 3.7 to 3.9: https://www.freshports.org/devel/brz/

Then use Docker with my image to compile. Or use the latest development version of avr-libc and version 11 of avr-gcc without DFP.

I tried docker but for some reason the daemon doesn’t want to start, there is some contradictory information about renamed files in the FBSD guide so I will look into that later.

The main thing is to get the firmware for the D4V2 compiled and the SC31pro, not worried about code size as I will remove code anyway, so could you give the steps to compile the devel version of avr-libc? There is no configure file (logically) and though I have automake and autoconf installed, trying those I get errors about missing M4 files. This information would probably be useful for anyone else who wants to do this.

SammysHP
SammysHP's picture
Offline
Last seen: 9 hours 43 min ago
Joined: 06/25/2019 - 14:35
Posts: 1816
Location: Germany

Pages