Skip to content

Commit

Permalink
Merge 0045183 into 972285c
Browse files Browse the repository at this point in the history
  • Loading branch information
ajfisher committed Oct 5, 2020
2 parents 972285c + 0045183 commit 033af44
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 17 deletions.
16 changes: 10 additions & 6 deletions Makefile
Expand Up @@ -57,13 +57,12 @@ clean-build-firmata:
rm -rf $(BUILD_DIR)/node_pixel_firmata

clean-build: clean-build-backpack clean-build-firmata
@# grunt clean
@# remove the compiled bins
rm -rf $(BIN_DIR)/firmata/*
rm -rf $(BIN_DIR)/backpack/*

clean-compiled:
# removes all of the compilation intermediate files
@# removes all of the compilation intermediate files
for f in $(BIN_DIR)/*/*/*; \
do \
if [[ $${f} != *.ino.hex ]]; \
Expand All @@ -72,6 +71,10 @@ clean-compiled:
fi; \
done

@# remove the intermediate build files from the build directory too
rm -rf $(BUILD_DIR)/backpack/build
rm -rf $(BUILD_DIR)/node_pixel_firmata/build

install: clean
@echo "Installing all of the packages needed"
npm install
Expand Down Expand Up @@ -139,12 +142,13 @@ compile: build-backpack build-firmata $(BOARD_TGTS)

$(BOARD_TGTS):
@# make the firmata bin for this target board
$$ARDUINO_PATH --verify --verbose-build --board $(PKG_$@) \
--pref build.path=$(BIN_DIR)/firmata/$@ $(FIRMATA_INO)
arduino-cli compile --verbose -b $(PKG_$@) \
--build-path=$$PWD/$(BIN_DIR)/firmata/$@ $(FIRMATA_INO)

@# make the firmata bin for this target board
$$ARDUINO_PATH --verify --verbose-build --board $(PKG_$@) \
--pref build.path=$(BIN_DIR)/backpack/$@ $(BACKPACK_INO)
arduino-cli compile --verbose -b $(PKG_$@) \
--build-path=$$PWD/$(BIN_DIR)/backpack/$@ $(BACKPACK_INO)


test-release:
npm run release -- --dry-run
Expand Down
39 changes: 28 additions & 11 deletions firmware/src/README.md
Expand Up @@ -24,21 +24,25 @@ relevant locations during the build process.

## Dev environment set up

Due to the way this is all managed, the best way to work with this set up is
to use something like arduino CLI tools so you can edit and then use make to
build and compile the files.
This is all built using the `arduino-cli` command line tools.

If you don't have that sort of setup then the next easiest way is to switch your
arduino IDE in preferences to "use an external editor". Then open up the target
you want to build and edit the source file in a separate editor (eg Sublime Text,
Vim or whatever). Then when you compile, the file and any supporting files will
be loaded.
Firstly - install the arduino-cli
[according to the directions here](https://arduino.github.io/arduino-cli/latest/installation/)
on the arduino CLI site.

Export the path to your ARDUINO application:
You should also view the [getting started guide](https://arduino.github.io/arduino-cli/latest/getting-started/)
because you will need to ensure that you have all of the cores etc all set up
for use in your default configuration.

`export ARDUINO_PATH=~/Downloads/Arduino.app/Contents/MacOS/Arduino`
The main cores you will need are:

To make sure it's available to make.
* arduino:avr

You may also need to install some core libs as well. You can do this with the
`arduino-cli lib install` command. Some that may not be included by default are
listed below (note capitalisation):

* Servo

## Make

Expand All @@ -53,6 +57,19 @@ command like invocation.
A useful trick is if you just want to build one target use `make uno` or `make nano`
and this will build just the backpack and firmata for that target.

## Uploading a file for testing

The easiest way to do this is to build and upload using the arduino IDE. If you
don't want to do that and want to test the actual build process to make sure
the hex file you're outputting makes sense then you can do it using avrgirl

eg:

```
npx avrgirl-arduino flash -f firmware/bin/firmata/uno/node_pixel_firmata.ino.hex -a uno
```

Will flash the output firmata hexfile for uno to the board.

## Building for deployment

Expand Down

0 comments on commit 033af44

Please sign in to comment.