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

Add Linux support to the Makefile #64

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM alpine:3.14
RUN apk add --no-cache alpine-sdk
RUN git clone https://github.com/mat1jaczyyy/LP-Firmware-Utility/ /tmp/utils

WORKDIR /tmp/utils
RUN make tools
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.PHONY: all clean

ifeq ($(OS),Windows_NT)

define rmdir
Expand All @@ -18,6 +20,9 @@ define mkdir
mkdir -p "$(1)"
endef

UNAME := $(shell uname)
OCIRUNTIME = docker

endif

BUILDDIR = build
Expand Down Expand Up @@ -67,9 +72,19 @@ LDFLAGS += -T$(LDSCRIPT) -u _start -u _Minimum_Stack_Size -mcpu=cortex-m3 -mthu

all: $(SYX)

ifeq ($(UNAME), Linux)
$(SYX): $(BIN)
$(OCIRUNTIME) build -t bintosyxbuilder .
$(OCIRUNTIME) run --rm -it \
-v $(shell pwd)/$(BUILDDIR):/tmp/utils/$(BUILDDIR) \
bintosyxbuilder \
./tools/out/bintosyx /pro 000 $(BIN) $(SYX)
else
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interested in your thoughts on having macOS build the bintosyx tool via Docker from the other repo as well. The only counter-argument I can think of is that macOS machines don't come with gcc preinstalled (but, anyone tinkering with this on a Mac is likely to have gcc installed anyway).

For Windows I'd avoid using Docker and keep the currently prebuilt EXE because you have to either make VS a requirement or deal with the mess of using gcc on Windows, both of which I'd prefer to avoid in a firmware project.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could go either way for Mac, assuming the already provided tools/bintosyx binary has been working. Maybe in another branch, I can experiment with it and let you know what I think.


# build the final sysex file from the ELF - run the simulator first
$(SYX): $(BIN)
./$(BINTOSYX) /pro 000 $(BIN) $(SYX)
endif

$(BIN): $(ELF)
$(OBJCOPY) -O binary $< $@
Expand Down
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,48 @@ Then, to directly compile the code:
make
```

### Linux

Install the GCC ARM toolchain through your package manager.
You'll also need a container runtime such as `podman` or `docker` to build part of the tooling.

Compile with:

```
make
```

#### Flashing

The MIDI SysEx utility, `amidi`, comes preinstalled on most Linux distributions
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The recommended way to flash on all platforms is through https://fw.mat1jaczyyy.com, though I suppose a short mention of amidi can be added to the Installation section near the beginning of the readme instead of the full blown explanation.

Copy link
Author

@sodaplayer sodaplayer Sep 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! Cleared out the full explanation from the README and added amidi to the list at the top.

as a part of ALSA. You can use this to flash your Launchpad.

Start your Launchpad in bootloader mode, and in a terminal, enter `amidi -l`.
Pay attention to the device column. These are the ports of your MIDI devices.

```
% amidi -l
Dir Device Name
IO hw:2,0,0 ...
IO hw:3,0,0 ...
IO hw:4,0,0 Launchpad Pro Launchpad Pro
IO hw:5,0,0 ...
```

You should see your Launchpad listed. In my case the port number is `hw:4,0,0`.
Send the firmware to your Launchpad with `amidi -p [port] -s build/cfw.syx`.

```
amidi -p hw:4,0,0 -s build/cfw.syx
```

If you run into issues with the flashing being interrupted,
try adding a few milliseconds of interval to `amidi` with the `-i ms` option.

```
amidi -p hw:4,0,0 -s build/cfw.syx -i 2
```

## Issues

Some Setup parameters found on the stock firmware are not implemented in order to simplify the firmware, including:
Expand Down