shakna-israel / aardvark- Goto Github PK
View Code? Open in Web Editor NEWCodename Aardvark, a cli tool for working with Arduino-compatible boards
License: MIT License
Codename Aardvark, a cli tool for working with Arduino-compatible boards
License: MIT License
Assembling the avrdude pipeline
Any intermediary files are built to a temporary directory, and cleaned up if there are no errors.
Otherwise the user can clean the temporary directory themselves, and the temporary directory should get reported at the start of a build procedure.
Example:
> aardvark build 'Arduino Pro Mini' ttyUSB main.c
Building to /var/folders/d9/t77j046j6_s6wkm5d3x_pll80000gn/T/tmp.wN7e9UWz
Finished successfully.
getmodeldata doesn't work as expected...
> getmodeldata 'Arduino Pro Mini'
115200 atmega328p 32256 2048
19200 atmega168 30720 2048
19200 atmega168 30720 2048
57600 atmega328p 30720 2048
57600 atmega328p 30720 2048
19200 atmega168 30720 2048
19200 atmega168 30720 2048
57600 atmega328p 30720 2048
57600 atmega328p 30720 2048
19200 atmega168 14336 1024
115200 atmega1280 126976
115200 atmega2560 253952
115200 atmega1280 126976
115200 atmega2560 253952 8192
57600 atmega32u4 28672 2560
57600 atmega32u4 28672 2560
57600 atmega32u4 28672 2560
57600 atmega32u4 28672 2560
115200 atmega328p 28672 2048
115200 atmega328p 28672 2048
19200 atmega168 14336 1024
115200 atmega328p 32256 2048
57600 atmega328p 30720 2048
19200 atmega328p 28672 2048
19200 atmega328p 28672 2048
19200 atmega168 14336 1024
57600 atmega32u4 28672 2560
57600 atmega328p 30720 2048
57600 atmega328p 30720 2048
19200 atmega168 14336 1024
57600 atmega328p 30720 2048
57600 atmega328p 30720 2048
57600 atmega328p 30720 2048
57600 atmega328p 30720 204
57600 atmega328p 30720 204
57600 atmega328p 30720 204
19200 atmega168 14336 1024
19200 atmega168 14336 1024
19200 atmega168 14336 1024
19200 atmega168 14336 1024
115200 atmega168 14336 1024
115200 atmega168 14336 1024
115200 atmega8 7168 1024
57600 atmega32u4 28672 2560
Kinda shocked that compiling works if this is the case.
avr-size
can, given an ELF file, tell us how big our program is, and how much RAM it takes up.
Assemble the avr-gcc pipeline
Tab completions for bash, zsh and fish would probably be helpful.
Should we attempt to drag down dependencies, with user permission? Or is that beyond scope?
We need to try and confirm the port exists, but maybe also if it can be written to, or read from.
A brand-name Arduino has some licensing restrictions. May need to replace Arduino-references with better wording about clone compatibility.
Witthout Arduino IDE we're left with a more complex C syntax.
Compare:
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
Against the C version:
#include <avr/io.h>
#include <util/delay.h>
int main (void)
{
DDRB |= _BV(DDB5);
while(1) {
PORTB |= _BV(PORTB5);
_delay_ms(1000);
PORTB &= ~_BV(PORTB5);
_delay_ms(1000);
}
}
It'd be nice to write some wrappers around the common operations.
Shellcheck noticed some smells, maybe a small bug
> shellcheck aardvark
In aardvark line 5:
VER='0.0'
^-- SC2034: VER appears unused. Verify it or export it.
In aardvark line 14:
if [ "$(uname)" == "Darwin" ]; then
^-- SC2039: In POSIX sh, == in place of = is undefined.
In aardvark line 31:
root=$(dirname $($rlink -f $0))
^-- SC2046: Quote this to prevent word splitting.
^-- SC2086: Double quote to prevent globbing and word splitting.
In aardvark line 33:
wd=$(pwd)
^-- SC2034: wd appears unused. Verify it or export it.
In aardvark line 35:
. "$root/.help"
^-- SC1090: Can't follow non-constant source. Use a directive to specify location.
In aardvark line 37:
if [ -z "$1" ] || [ "$1" == '--help' ] || [ "$1" == '-h' ]; then
^-- SC2039: In POSIX sh, == in place of = is undefined.
^-- SC2039: In POSIX sh, == in place of = is undefined.
In aardvark line 42:
. "$root/.model-tools"
^-- SC1090: Can't follow non-constant source. Use a directive to specify location.
In aardvark line 44:
if [ "$1" == 'list' ]; then
^-- SC2039: In POSIX sh, == in place of = is undefined.
In aardvark line 49:
. "$root/.tools"
^-- SC1090: Can't follow non-constant source. Use a directive to specify location.
In aardvark line 50:
. "$root/.main"
^-- SC1090: Can't follow non-constant source. Use a directive to specify location.
In aardvark line 52:
if [ "$1" == 'build' ]; then
^-- SC2039: In POSIX sh, == in place of = is undefined.
In aardvark line 57:
if [ "$1" == 'compile' ]; then
^-- SC2039: In POSIX sh, == in place of = is undefined.
In aardvark line 62:
if [ "$1" == 'flash' ]; then
^-- SC2039: In POSIX sh, == in place of = is undefined.
In aardvark line 68:
echo 'Try `aardvark --help`' >&2
^-- SC2016: Expressions don't expand in single quotes, use double quotes for that.
It couldn't review our imports by itself, so...
File: .help
> shellcheck -s sh .help
No issues there.
File: main
> shellcheck -s sh .main
In .main line 13:
echo 'Confirm it can be found in `aardvark list`' >&2
^-- SC2016: Expressions don't expand in single quotes, use double quotes for that.
In .main line 52:
maxsize=$(getmaxsize "$1")
^-- SC2034: maxsize appears unused. Verify it or export it.
In .main line 55:
datasize=$(getmaxdatasize "$1")
^-- SC2034: datasize appears unused. Verify it or export it.
In .main line 74:
echo $(ls -lah "$3".ihex)
^-- SC2046: Quote this to prevent word splitting.
^-- SC2005: Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.
In .main line 88:
echo 'Confirm it can be found in `aardvark list`' >&2
^-- SC2016: Expressions don't expand in single quotes, use double quotes for that.
In .main line 96:
if [ -z /dev/"$2" ]; then
^-- SC2157: Argument to -z is always false due to literal strings.
Some false positives, one or two subtle bugs.
File: .model-tools
> shellcheck -s sh .model-tools
In .model-tools line 2:
cat "$root/.models" | awk -F '|' '{print $1}'
^-- SC2002: Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
^-- SC2154: root is referenced but not assigned.
SC2154 isn't relevant, as root
is assigned in a different file, earlier.
SC2002 is basically an optimisation.
File: .tools
> shellcheck -s sh .tools
Nothing here.
We should use dialog or whiptail if they're available, via a cli switch.
A file listing dependencies would be useful.
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.