Optiboot / optiboot

Small and Fast Bootloader for Arduino and other Atmel AVR chips
Other
1.09k stars 401 forks source link

Makefile: help target: added -e option to echo command for escaped output to show correct #241

Closed UffeJakobsen closed 6 years ago

UffeJakobsen commented 6 years ago

Command: "make help" did now display correctly - (escaped) newlines was litterly shown as \n in output

WestfW commented 6 years ago

Interesting. I swear the current code works correctly on my mac! Did you try building on windows? I also get:

 /bin/echo -e "foo\n"
-e foo\n

(ah. bash and the shell Atmel provides support for -e, but /bin/echo and the windows cmd ECHO don't.)

UffeJakobsen commented 6 years ago

Well then the challenge is to find a common way to output the help correctly

On Linux the output looks like this (without the "echo -e"):

(https://linux.die.net/man/1/echo)

# make help
Option BAUD_RATE=nnnn - set the bit rate for communications\n Option LED=B3 - set LED pin to particular port/bit\n Option LED_START_FLASHES=n - set number of LED flashes when bootloader starts\n Option LED_DATA_FLASH=1 - flash the LED each time data is received.\n Option LED_START_ON=1 - Turn the LED on at bootload start\n Option BIGBOOT=1 - enable extra features up to 1kbytes\n Option SUPPORT_EEPROM=1 - Include code to read/write EEPROM\n Option SOFT_UART=1 - use a software (bit-banged) UART\n Option UART=n - use UARTn for communications\n \n-------------\n\n target virboot8 - ATmega8 with virtual boot partition\n target virboot328p - ATmega328 with virtual boot partition\n target atmega8 - ATmega8, ATmega8A, ATmega8L\n target atmega168 - ATmega168, ATmega168A\n target atmega328 - ATmega328p\n target atmega1280 - ATmega1280 (100pin, 128k)\n target xplained168pb - Atmel Xplained Mini 168pb Eval board\n target xplained328pb - Atmel Xplained Mini 328pb Eval board\n target xplained328p - Atmel Xplained Mini 328p Eval board\n target atmega88 - ATmega88 or ATmega88p (28pin, 8k)\n target atmega168p - ATmega168p\n target atmega16 - ATmega16 (40pin, 16k)\n target atmega32 - ATmega32 (40pin, 32k)\n target atmega644p - ATmega644p\n target atmega1284 - ATmega1284p (40 pin, 128k)\n target sanguino - ATmega644p board\n target mighty1284 - ManiacBug Mighty1284 board\n target bobuino - Crossroads 1284 board\n target wildfirev2 - Wicked Devices board\n target wildfirev3 - Wicked Devices board\n target wildfire - Wicked Devices Wildfire v1 board\n target atmega2560 - ATmega2560p (100pin, 256k)\n target mega2560 - Arduino MEGA2560 board, 2560ADK\n

UffeJakobsen commented 6 years ago

Forgot to answer your quiestion: Sorry but I do not have Windows

As make is not a standard compunent of Windows I suspect that you use Cygwin or the new Microsoft linux emulation layer - or something else ?

Question do you have the "printf" command available under your Windows ? If so that could be the universal solution to output the escaped help text on all platforms

Both Linux and FreeBSD have a similar working "printf" command:

https://linux.die.net/man/1/printf https://www.freebsd.org/cgi/man.cgi?query=printf

PS: MacOSX userspace commands are originally derived from FreeBSD - so "printf" should also work on MacOSX - the question is if you have in Windows... :-)

WestfW commented 6 years ago

It looks like Atmel Studio's "shell tools" contain an implementation of printf. But it doesn't seem to work correctly :-(

heh. the build on MacOS now prints "-e" as well as the rest. I guess it runs internally or /bin/echo instead of going through an intermediate shell. I can live with this; it's better than the "\n"s appearing.

Added as part of https://github.com/Optiboot/optiboot/commit/8eb696369a16e9a579ddbb604df0c606bcff5147