# Electra One firmware sources

**URL:** <https://forum.electra.one/t/electra-one-firmware-sources/981>\
**Category:** Developers\
**Tags:** controller-firmware\
**Created:** [October 4, 2021, 7:23am UTC](https://forum.electra.one/t/electra-one-firmware-sources/981 "2021-10-04T07:23:22Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![martin](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/martin/32/145_2.png) [@martin](https://forum.electra.one/u/martin)\
**Post date:** [October 4, 2021, 7:23am UTC](https://forum.electra.one/t/electra-one-firmware-sources/981/1 "2021-10-04T07:23:22Z")

</div>

As promised, the Electra One firmware source code has been made available:

> **[GitHub - electraone/firmware: Electra One base firmware](https://github.com/electraone/firmware)**
>
> Electra One base firmware. Contribute to electraone/firmware development by creating an account on GitHub.

It comes with a few demo/tutorial applications. Please note, we are still in an early days of this. I might be still changing the API. If you wanted to make any serious work, please be in touch with me.

The source code covers Electra’s base firmware. ie. the Midi controller app that you have been using so far runs on top of that. I will provide the sources of that application a little bit later. I want to make sure that it runs smoothly on the latest base firmware.

A few remarks:

1. Anybody who wanted to contribute is welcome.
2. A new website dedicated to the Electra One app development will be launched. The documentation and app repository will be there.
3. Even though this provides the C++ JUCE like API, the Lua interpreter is available in the firmware. I will be working on extending that part. My goal is to make it possible to create full-blown apps in Lua too.
4. The base firmware has been extracted from the current Midi controller firmware and made somewhat more generic. It is a work in progress. There are still things that need cleaning up, improving, changing.
5. The sources contains Doxygen comments. I will keep working on them in coming days so that full documentation is available soon.
6. The build toolchain work perfectly on MacOS X. Windows and Linux still need some doing. It is possible to get it going though.

I would like to say thank you to @thetechnobear, @akira, @shankar, @joris.roling, @ziv for pushing me to go this direction, helping me, and providing tons of valuable input!

Any questions or suggestions. Let me know. Happy coding!

---

<div class="post-metadata">

**Author:** ![joris.roling](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/joris.roling/32/375_2.png) [@joris.roling](https://forum.electra.one/u/joris.roling)\
**Post date:** [October 4, 2021, 8:06am UTC](https://forum.electra.one/t/electra-one-firmware-sources/981/2 "2021-10-04T08:06:42Z")

</div>

I have it compiling, yeah! 😃

build directory contains a **firmware.elf** and **firmware.hex** (no **firmware.img** though, like the docs suggest)

---

<div class="post-metadata">

**Author:** ![martin](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/martin/32/145_2.png) [@martin](https://forum.electra.one/u/martin)\
**Post date:** [October 4, 2021, 8:08am UTC](https://forum.electra.one/t/electra-one-firmware-sources/981/3 "2021-10-04T08:08:44Z")

</div>

check the `.bin` folder in the `./firmware`. The hex2k66img tool should be there. If not you can build it. it is part of the sources.

running `./scripts/install-tools` should do that.

---

<div class="post-metadata">

**Author:** ![joris.roling](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/joris.roling/32/375_2.png) [@joris.roling](https://forum.electra.one/u/joris.roling)\
**Post date:** [October 4, 2021, 8:16am UTC](https://forum.electra.one/t/electra-one-firmware-sources/981/4 "2021-10-04T08:16:45Z")

</div>

> [@martin](#):
>
> ./scripts/install-tools

The tool is there, but no **firmware.img** (even) after

```auto
make clean
make

```

I’ve sent you the make output via PM

---

<div class="post-metadata">

**Author:** ![martin](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/martin/32/145_2.png) [@martin](https://forum.electra.one/u/martin)\
**Post date:** [October 4, 2021, 8:39am UTC](https://forum.electra.one/t/electra-one-firmware-sources/981/5 "2021-10-04T08:39:00Z")

</div>

run `make upload`, it will generate the binary firmware image and will transfer it to the controller.

```auto
martinpavlas:firmware (main)$ make upload
Electra firmware loader, v1.0
Programming mode entered
Waiting for Electra to appear
Uploading firmware: ..............................................................................
...............................................................................................................
.....................................................
Restarting Electra
martinpavlas:firmware (main)$

```

---

<div class="post-metadata">

**Author:** ![joris.roling](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/joris.roling/32/375_2.png) [@joris.roling](https://forum.electra.one/u/joris.roling)\
**Post date:** [October 4, 2021, 9:15am UTC](https://forum.electra.one/t/electra-one-firmware-sources/981/6 "2021-10-04T09:15:22Z")

</div>

I got the image making working by making a `make` target like:

```auto
image: $(BUILDDIR)/$(TARGET).hex
	@$(HEX2IMAGE) $< $(basename $<).img

```

and then

```auto
make image

```

---

<div class="post-metadata">

**Author:** ![joris.roling](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/joris.roling/32/375_2.png) [@joris.roling](https://forum.electra.one/u/joris.roling)\
**Post date:** [October 4, 2021, 9:34am UTC](https://forum.electra.one/t/electra-one-firmware-sources/981/7 "2021-10-04T09:34:18Z")

</div>

The `make upload` call gives me this:

```nohighlight
Electra firmware loader, v1.0
Error opening HID Manager
Programming mode entered
Waiting for Electra to appear

```

Uploading the **firmware.img** using **Electra One Console** gives me a demo app, is this expected? (I was expecting the **ctrlv2** app)

PS In the **makefile** I did change the `CTRL_PORT` to `Electra Controller A Electra CTRL`, as I’m running two Electra One’s 😉

---

<div class="post-metadata">

**Author:** ![martin](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/martin/32/145_2.png) [@martin](https://forum.electra.one/u/martin)\
**Post date:** [October 4, 2021, 9:48am UTC](https://forum.electra.one/t/electra-one-firmware-sources/981/8 "2021-10-04T09:48:52Z")

</div>

> [@joris.roling](#):
>
> I was expecting the **ctrlv2** app

that is correct, the base firmware comes with the demo app.

> [@joris.roling](#):
>
> `Error opening HID Manager`

I think this will be about the permissions to access the HID interface. New MacOS X systems block that by default. Will review that, I do belive that I had to grant permission to “access keyboard (HID)” in the past. Maybe @thetechnobear knows, he did that recently.

---

<div class="post-metadata">

**Author:** ![martin](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/martin/32/145_2.png) [@martin](https://forum.electra.one/u/martin)\
**Post date:** [October 4, 2021, 9:51am UTC](https://forum.electra.one/t/electra-one-firmware-sources/981/9 "2021-10-04T09:51:00Z")

</div>

> [@joris.roling](#):
>
> I got the image making working by making a `make` target

I will move .img creation to the default make rule.

---

<div class="post-metadata">

**Author:** ![joris.roling](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/joris.roling/32/375_2.png) [@joris.roling](https://forum.electra.one/u/joris.roling)\
**Post date:** [October 4, 2021, 9:54am UTC](https://forum.electra.one/t/electra-one-firmware-sources/981/10 "2021-10-04T09:54:04Z")

</div>

Yes, I was asked to allow **Input Monitoring** for **Terminal** , I did allow that.

---

<div class="post-metadata">

**Author:** ![thetechnobear](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/thetechnobear/32/134_2.png) [@thetechnobear](https://forum.electra.one/u/thetechnobear)\
**Post date:** [October 4, 2021, 9:59am UTC](https://forum.electra.one/t/electra-one-firmware-sources/981/11 "2021-10-04T09:59:56Z")

</div>

> [@joris.roling](#):
>
> Yes, I was asked to allow **Input Monitoring** for **Terminal** , I did allow that.

yup that was all that was required…

I think it tells you that you have to reboot for it to take effect.  
but iirc, you just have to make sure the Terminal process is restarted. (not just closing windows/tabs)

generally if you see waiting for Electra to appear, the reason is its not in update mode.  
usually because the sysex that is sent to force it into update mode has not work, either because the sendmidi didn’t work or because the E1 has ‘crashed’ so is not responding to it.  
in either case, you can powercycle e1 with update button pressed and it’ll then load the firmware.

> [@joris.roling](#):
>
> PS In the **makefile** I did change the `CTRL_PORT` to `Electra Controller A Electra CTRL` , as I’m running two Electra One’s 😉

Ive not checked latest makefile - but you should not need to edit the makefile - usually you can just override it from the command line.

if this is not possible on that var at the moment, then we should make it so it is…

---

<div class="post-metadata">

**Author:** ![thetechnobear](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/thetechnobear/32/134_2.png) [@thetechnobear](https://forum.electra.one/u/thetechnobear)\
**Post date:** [October 4, 2021, 10:06am UTC](https://forum.electra.one/t/electra-one-firmware-sources/981/12 "2021-10-04T10:06:08Z")

</div>

> [@martin](#):
>
> As promised, the Electra One firmware source code has been made available:

congratulations!

Ive had family visiting, so not been playing with this since Superbooth, but Ive see how much work you have put into this over last couple of weeks - a tremendous effort !

my plan is this week to update the Orac firmware to reflect all these changes!  
once that’s done and tested, then that can be released…  
(it also be open source so provide another ‘example’ firmware app for devs to look over)

---

<div class="post-metadata">

**Author:** ![joris.roling](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/joris.roling/32/375_2.png) [@joris.roling](https://forum.electra.one/u/joris.roling)\
**Post date:** [October 4, 2021, 10:11am UTC](https://forum.electra.one/t/electra-one-firmware-sources/981/13 "2021-10-04T10:11:28Z")

</div>

> [@martin](#):
>
> > [@joris.roling](#):
> >
> > I was expecting the **ctrlv2** app
> 
> that is correct, the base firmware comes with the demo app.

Ah, I stand corrected 😃 Thnx for clearing that up to me.

---

<div class="post-metadata">

**Author:** ![martin](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/martin/32/145_2.png) [@martin](https://forum.electra.one/u/martin)\
**Post date:** [October 4, 2021, 10:14am UTC](https://forum.electra.one/t/electra-one-firmware-sources/981/14 "2021-10-04T10:14:56Z")

</div>

I will make sure that the ctrlv2 works perfectly with the new base firmware. Once it is done, I will upload it to the GitHub too.

---

<div class="post-metadata">

**Author:** ![martin](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/martin/32/145_2.png) [@martin](https://forum.electra.one/u/martin)\
**Post date:** [October 6, 2021, 4:40am UTC](https://forum.electra.one/t/electra-one-firmware-sources/981/15 "2021-10-06T04:40:47Z")

</div>

> [@joris.roling](#):
>
> I got the image making working by making a `make` target like:
> 
> ```auto
> image: $(BUILDDIR)/$(TARGET).hex
> @$(HEX2IMAGE) $< $(basename $<).img
> 
> ```
> 
> and then
> 
> ```auto
> make image
> 
> ```

`make image` has been added and it is also part of the `make all`. ie. the `firmware.img` file is created by default.

---

<div class="post-metadata">

**Author:** ![thetechnobear](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/thetechnobear/32/134_2.png) [@thetechnobear](https://forum.electra.one/u/thetechnobear)\
**Post date:** [October 7, 2021, 12:53pm UTC](https://forum.electra.one/t/electra-one-firmware-sources/981/16 "2021-10-07T12:53:24Z")

</div>

started to look at new latest source to move over to it 🙂

two quick observations for new devs (assuming on MacOS)

### a) use homebrew

the easy way to get started is to use homebrew as a package manager, rather than installing the ARM tools directly, as this has everything you need.

> **[Homebrew](https://brew.sh)**
>
> The Missing Package Manager for macOS (or Linux).

you then want the arm embedded library

> **[gcc-arm-embedded](https://formulae.brew.sh/cask/gcc-arm-embedded#default)**
>
> Homebrew’s package index

you will then need to compile with the COMPILERPATH set  
e.g.

```auto
make COMPILERPATH="/opt/homebrew/bin" (etc) 

```

we could change MAKEFILE to perhaps look for these as an alternative source for compiler?

note: homebrew uses two different locations  
/usr/local/homebrew is used for Intel  
/opt/homebrew is used for Apple Silicon

### b) you don’t need to link the application into the firmware directory.

I personally really dislike changing the contents of a repo Im using  
(esp. since git will then report its as altered)

so rather than using symbolic links, APPPATH can be set to directory containing

so I use

```auto
make COMPILERPATH="/opt/homebrew/bin" APPPATH=../HelloWorldApp upload

```

---

<div class="post-metadata">

**Author:** ![martin](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/martin/32/145_2.png) [@martin](https://forum.electra.one/u/martin)\
**Post date:** [October 8, 2021, 10:06am UTC](https://forum.electra.one/t/electra-one-firmware-sources/981/17 "2021-10-08T10:06:18Z")

</div>

> [@thetechnobear](#):
>
> use homebrew

Perfect, will add brew install to the README

> [@thetechnobear](#):
>
> so rather than using symbolic links, APPPATH can be set to directory containing
> 
> so I use
> 
> ```auto
> make COMPILERPATH="/opt/homebrew/bin" APPPATH=../HelloWorldApp upload
> 
> ```

I haven’t mentioned that one as the relative path `../` will cause the app directory to be copied outside the `build`. Therfore the repo will be affected too. I will fix it in the Makefile. The main goal is to be able to build a static library with a suite of header files. Then, the firmware repo would be needed only when one wanted to work on the base firmware itself.

---

<div class="post-metadata">

**Author:** ![thetechnobear](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/thetechnobear/32/134_2.png) [@thetechnobear](https://forum.electra.one/u/thetechnobear)\
**Post date:** [October 8, 2021, 10:45am UTC](https://forum.electra.one/t/electra-one-firmware-sources/981/18 "2021-10-08T10:45:10Z")

</div>

I do like that don’t ‘depend’ on anything other than the embedded arm toolchain.  
but yeah, I think most that aren’t doing other embedded work, will find homebrew fantastic 🙂

* * *

APPPATH  
yeah, i did have a look at that ‘issue’, but its not easy to fix with the way the makefile currently works.

can I suggest an alternative approach 🙂 (as its how I work , with other projects. )

expect the firmware to be contained in a subdirectory (I’ll get to why, in a moment)

so we have a project structure like  
~/Projects/HelloWorld/HelloWorld/src  
~/Projects/HelloWorld/external/firmware

basically I put any ‘external’ library/dependancies in a separate subdirectory to keep them separate.

why do i do it like this?  
because git supports something called ‘submodules’ , these allow you to have a repo containing references to other repos.

so when we create our helloworld directory, we do

```auto
mkdir external
git submodule add https://github.com/electraone/firmware external

```

now when another dev wants to use our hello world app, all they need to do is

```auto
git clone https://github.com/electraone/helloworld
cd helloworld
git submodule update --init --recursive

```

this clones the repo, and then retrieves all submodules defined

what’s cool about this approach, is the firmware is tagged to a particular version NOT to main (!) - so the build is ‘complete’ even if the firmware moves on.

(the dev can of course at anytime update the firmware submodule, and push it, so that HelloWorld now uses the latest firmware source)

submodule are very cool!

important note:  
putting firmware in ./external/firmware does not obligate devs to use submodules,  
they could of course do a symbolic link, or just copy the source code there if they like.

* * *

Id also suggest we ‘invert’ the makefile

so have the main makefile in HelloWorld/makefile , and perhaps then just ‘include’ external/firmware/Makefile … so use that firmware makefile for convenient macros etc.  
(devs can then use the HelloWorld makefile as an example to get started)

* * *

all that said, I think you have now made firmware pretty much standalone…  
if so, then i could look at creating an example that uses cmake, which as we discussed previously, I think will be much cleaner 🙂

---

<div class="post-metadata">

**Author:** ![Uija](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/uija/32/236_2.png) [@Uija](https://forum.electra.one/u/Uija)\
**Post date:** [June 14, 2022, 9:27am UTC](https://forum.electra.one/t/electra-one-firmware-sources/981/19 "2022-06-14T09:27:43Z")

</div>

Little late to the party, but I followed your path with using home-brew to install the gcc arm embedded stuff, but have issues on that the internet tells me, its a bug in gcc ☹

> jk@MacBook-Air-von-Jens firmware % make COMPILERPATH=/opt/homebrew/bin  
> -e [CXX] src/App.cpp  
> In file included from /Applications/ARM/arm-none-eabi/include/c++/11.2.1/bits/specfun.h:46,  
> from /Applications/ARM/arm-none-eabi/include/c++/11.2.1/cmath:1935,  
> from /Applications/ARM/arm-none-eabi/include/c++/11.2.1/math.h:36,  
> from base/WProgram.h:6,  
> from base/Arduino.h:6,  
> from lib/ADC/ADC\_Module.h:34,  
> from lib/ADC/ADC.h:45,  
> from src/Hardware/Pot.h:3,  
> from src/Hardware/Pots.h:4,  
> from src/Hardware/Hardware.h:4,  
> from src/App.h:3,  
> from src/App.cpp:1:  
> /Applications/ARM/arm-none-eabi/include/c++/11.2.1/limits:1673:7: internal compiler error: Illegal instruction: 4  
> 1673 | min() \_GLIBCXX\_USE\_NOEXCEPT { return **FLT\_MIN** ; }  
> | ^~~  
> Please submit a full bug report,  
> with preprocessed source if appropriate.  
> See [https://bugs.linaro.org/](https://bugs.linaro.org/) for instructions.  
> make: \*\*\* [build/src/App.o] Error 1

I am on a M1 Mac (as you are, it seems). Didn’t you had that issues? Or did you find a solution?

---

<div class="post-metadata">

**Author:** ![Uija](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/uija/32/236_2.png) [@Uija](https://forum.electra.one/u/Uija)\
**Post date:** [June 14, 2022, 9:35am UTC](https://forum.electra.one/t/electra-one-firmware-sources/981/20 "2022-06-14T09:35:32Z")

</div>

Installed the toolchain from the Website Martin links in the README and it worked

[Next page](https://forum.electra.one/t/electra-one-firmware-sources/981.md?page=2)
