casanovg / timonel Goto Github PK
View Code? Open in Web Editor NEWATtiny85/45/25 I2C bootloader
License: MIT License
ATtiny85/45/25 I2C bootloader
License: MIT License
"make-timonel-sh" doesn't execute under Linux (more properly when I use it from bash shell)
./make-timonel.sh: 40: ./make-timonel.sh: function: not found
(then the "Usage text"
./make-timonel.sh: 79: ./make-timonel.sh: Syntax error: "}" unexpected
Problem seems to be line 1 hash-bang
#!/bin/sh
If I change this #!/bin/bash, it works
I suspect that your development environment regards bash and sh as functionally equivalent. but for me sh and bash are different executables. Lordy, lordy, I love Unix but how many shells can one operating system need? The documentation says that sh is synonym for dash, but that bash is different. Presumably my sh (dash) doesn't like your function syntax.... argggh. Workaround for me is to edit line 1. as noted above. I'm not really sure what linux best practice is here, and if there some incantation which always picks the right shell? I didn't want to submit a PR not knowing best practice.
As a sanity check, the sample output for ./make-timonel.sh tml-t85-small timonel 13 1B80 1 false is attached below.
Binary file: timonel.hex
TWI address: 13
RUNNING: make all CONFIG=tml-t85-small TARGET=timonel TIMONEL_TWI_ADDR=13 TIMONEL_START=1B80 LOW_FUSE=0x62 AUTO_CLK_TWEAK=false
========================================================================
Building Timonel configuration: tml-t85-small |
---|
TIMONEL_START = 0x1B80 |
======================================================================== |
... ENABLE_LED_UI = false |
... AUTO_PAGE_ADDR = false |
... APP_USE_TPL_PG = false |
... CMD_SETPGADDR = true |
... TWO_STEP_INIT = false |
... USE_WDT_RESET = false |
... APP_AUTORUN = false |
... CMD_READFLASH = false |
... CMD_READDEVS = false |
... EEPROM_ACCESS = false |
----------------------------------------------------------------------- |
... AUTO_CLK_TWEAK = false |
... LOW_FUSE = 0x62 |
... LED_UI_PIN = PB1 |
[Sections]
text data bss dec hex filename
896 0 198 1094 446 timonel.bin
Should i add -std=c99?
root@bananapim2zero:~/timonel/timonel-bootloader# make
tml-bootloader.c: In function ‘main’:
tml-bootloader.c:200:25: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (int i = 0; i < PAGE_SIZE - 2; i += 2) {
^
tml-bootloader.c:200:25: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
tml-bootloader.c: In function ‘ReceiveEvent’:
tml-bootloader.c:247:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (byte i = 0; i < commandBytes; i++) {
^
tml-bootloader.c: In function ‘RequestEvent’:
tml-bootloader.c:293:13: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (byte i = 0; i < GETTMNLV_RPLYLN; i++) {
^
tml-bootloader.c:347:17: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (byte i = 3; i < (RXDATASIZE + 1); i += 2) {
^
tml-bootloader.c:354:17: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (byte i = 1; i < (RXDATASIZE + 1); i += 2) {
^
tml-bootloader.c:364:13: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (byte i = 0; i < WRITPAGE_RPLYLN; i++) {
^
Makefile:55: recipe for target 'tml-bootloader.o' failed
make: *** [tml-bootloader.o] Error 1
Please write a sketch for attiny85 firmware upload by air.
There are many sketches of flashing esp8266 itself on wifi. .
Task: esp8266 get the firmware via wifi and upload it to your slave ittiny85 via i2c.
Thanks in advance.
Dear Gustavo,
It is a very good feature, thank you! I have a new feature request:
I will make more than one attiny85 module (but i don't know how many pieces, about 3-4 variety but summary about 30 attiny85 module per board), but i don't want a make fix i2c slave address for the bootloader. So, my question: is it possible that the bootloader check the free i2c slave address, and if got it a free address reserve it? (the currently range is ok)
Summary:
Thank You,
Gabor
In flash-timonel-bootloader.sh running under Linux (it's a 64-bit Ubuntu derivative) the line following
echo "[[[ Flashing Timonel for operating @ $ARG2 MHz ]]]";
is
avrdude -c USBasp -p attiny85 -B3 -U flash:w:.\releases\$ARG1.hex:i -B 20 -U lfuse:w:$LOW_FUSE:m -U hfuse:w:$HIGH_FUSE:m -U efuse:w:$EXTENDED_FUSE:m;
This breaks my bash script. I assume you mean to use / rather than \ here?
avrdude -c USBasp -p attiny85 -B3 -U flash:w:./releases/$ARG1.hex:i -B 20 -U lfuse:w:$LOW_FUSE:m -U hfuse:w:$HIGH_FUSE:m -U efuse:w:$EXTENDED_FUSE:m;
The backslash makes me wonder that perhaps you use Windows with a bash emulation of some kind which allows \ as a path separator, but "real" Linux file systems are more fussy. I make the change and the script runs to completion without errors.
Bash version
GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)
uname -a reports
Linux robert-ThinkPad-S3-Yoga-14 5.4.0-72-generic #80~18.04.1-Ubuntu SMP Mon Apr 12 23:26:25 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Can this bootloader be fitted to work with the ATTinyX4 family?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.