Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make-timonel.sh under Linux #22

Open
prandeamus opened this issue May 20, 2021 · 3 comments
Open

make-timonel.sh under Linux #22

prandeamus opened this issue May 20, 2021 · 3 comments
Assignees
Labels
bug Something isn't working solved Solved issue

Comments

@prandeamus
Copy link
Contributor

"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.


  • Starting Timonel compilation with these parameters:

  • Configuration: tml-t85-small
  •  Binary file: timonel.hex
    
  •  TWI address: 13
    
  • Flash position: 1B80 <- In case of errors, use lower positions!
  • CPU clock speed: 1 MHz <- RC OSC (low fuse = 0x62)
  • Auto clock tweak: false

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

[Hexfile] Take "data" size to calculate the bootloader's start address!
text data bss dec hex filename
0 896 0 896 380 timonel.hex

@prandeamus
Copy link
Contributor Author

Ignore format messup - output of the script was interpreted as markdown.

@casanovg casanovg added the bug Something isn't working label May 20, 2021
@casanovg
Copy link
Owner

I couldn't come to a definitive conclusion on what the correct hash-bang should be in this case.

I did several tests with "make-timonel.sh" on Fedora and CentOS and using #!/bin/sh or #!/bin/bash seems to be indistinct for this script. Maybe on non-Red Hat-like Linux distros, is not like this.

Given that #!/bin/bash also works fine for Git Bash on Windows, I'll use it everywhere, so this problem, for the moment, could be considered solved this way.

@casanovg casanovg added the solved Solved issue label May 23, 2021
@casanovg casanovg self-assigned this May 23, 2021
@prandeamus
Copy link
Contributor Author

That sounds good - for reference I'm using a Ubuntu derivative it belongs to the debian family.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working solved Solved issue
Projects
None yet
Development

No branches or pull requests

2 participants