# Vanilla Firmware Build fails to work after flash

**URL:** <https://forums.balena.io/t/vanilla-firmware-build-fails-to-work-after-flash/284556>\
**Category:** balenaFin\
**Created:** [April 7, 2021, 12:31pm UTC](https://forums.balena.io/t/vanilla-firmware-build-fails-to-work-after-flash/284556 "2021-04-07T12:31:54Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ricardoosorio](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ricardoosorio/32/5675_2.png) [@ricardoosorio](https://forums.balena.io/u/ricardoosorio)\
**Post date:** [April 7, 2021, 12:31pm UTC](https://forums.balena.io/t/vanilla-firmware-build-fails-to-work-after-flash/284556/1 "2021-04-07T12:31:54Z")

</div>

We are doing our best to solve the power on/off issue by building a new firmware. So our first approach was just to use the vanila [GitHub - balena-io-hardware/balena-fin-coprocessor-firmata: firmata firmware for the BGM111 co-processor on the balenaFin](https://github.com/balena-io-hardware/balena-fin-coprocessor-firmata) and build a hex without any changes. All went smooth (not sure if the log has any issue. [firmware.log](https://forums.balena.io/uploads/short-url/zS1OMufnAC6Q29SYBjfIT132sru.log) (25.6 KB) )

After that, we used the [GitHub - balena-io-hardware/balena-fin-firmata-flash: BalenaFin application to flash the on-board co-processor with the latest version of balenaFin Firmata](https://github.com/balena-io-hardware/balena-fin-firmata-flash) . It did work very well for the:  
curl -X POST localhost:1337/v1/flash/firmata-balena-2.0.1.hex  
The basic functions are there and they work: sleep, setpin, etc.

But when using our new firmware (suppose to have the same implementation) it does not work well. Any command will just make reboot the hardware and loose their state.

Can someone help us? Please? We can try to make a call or chat if required to close all our topics at once.

Thank you

---

<div class="post-metadata">

**Author:** ![ricardoosorio](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ricardoosorio/32/5675_2.png) [@ricardoosorio](https://forums.balena.io/u/ricardoosorio)\
**Post date:** [April 7, 2021, 3:12pm UTC](https://forums.balena.io/t/vanilla-firmware-build-fails-to-work-after-flash/284556/4 "2021-04-07T15:12:45Z")

</div>

Besides, can’t push to the device to build there. I try dev and production images. Both with same logs:

ricardoosorio@Ricardos-iMac balena-fin-coprocessor-firmata % balena push test  
[Info] Starting build for test, user rosorio  
[Info] Dashboard link: [balena dashboard](https://dashboard.balena-cloud.com/apps/1814540/devices)  
[Info] Building on arm06  
[Info] Pulling previous images for caching purposes…  
[Success] Successfully pulled cache images  
[main] Step 1/12 : FROM gcc:9.3.0  
[main] —\> 5e6b3f4af251  
[main] Step 2/12 : COPY ./src /usr/src/firmata  
[main] —\> 69be451addd5  
[main] Step 3/12 : COPY ./.git /usr/src/firmata/.git  
[main] COPY failed: stat /var/lib/balena32/tmp/docker-builder062117822/.git: no such file or directory  
[Info] Uploading images  
[Success] Successfully uploaded images  
[Error] Some services failed to build:  
[Error] Service: main  
[Error] Error: COPY failed: stat /var/lib/balena32/tmp/docker-builder062117822/.git: no such file or directory  
[Info] Built on arm06  
[Error] Not deploying release.  
Remote build failed

---

<div class="post-metadata">

**Author:** ![ricardoosorio](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ricardoosorio/32/5675_2.png) [@ricardoosorio](https://forums.balena.io/u/ricardoosorio)\
**Post date:** [April 7, 2021, 3:34pm UTC](https://forums.balena.io/t/vanilla-firmware-build-fails-to-work-after-flash/284556/5 "2021-04-07T15:34:45Z")

</div>

Getting nowhere now: using production image, firmware 2.0.1.hex…it changed revision from 09 to 11. And now nothing can work. Again.

---

<div class="post-metadata">

**Author:** ![pipex](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/pipex/32/4840_2.png) [@pipex](https://forums.balena.io/u/pipex)\
**Post date:** [April 7, 2021, 8:17pm UTC](https://forums.balena.io/t/vanilla-firmware-build-fails-to-work-after-flash/284556/7 "2021-04-07T20:17:10Z")

</div>

Hi Ricardo, regarding the firmware issue I will ping someone on the team to help with that.

For the second issue, it looks like the `.git` directory is not being uploaded to the builder. Do you have a `.dockerignore` file on your project directory?

---

<div class="post-metadata">

**Author:** ![ricardoosorio](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ricardoosorio/32/5675_2.png) [@ricardoosorio](https://forums.balena.io/u/ricardoosorio)\
**Post date:** [April 7, 2021, 8:31pm UTC](https://forums.balena.io/t/vanilla-firmware-build-fails-to-work-after-flash/284556/10 "2021-04-07T20:31:23Z")

</div>

I clone from the git. Deleted and re-clone. The same

Obter o [Outlook para Android](https://aka.ms/ghei36)

---

<div class="post-metadata">

**Author:** ![pipex](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/pipex/32/4840_2.png) [@pipex](https://forums.balena.io/u/pipex)\
**Post date:** [April 7, 2021, 8:56pm UTC](https://forums.balena.io/t/vanilla-firmware-build-fails-to-work-after-flash/284556/11 "2021-04-07T20:56:24Z")

</div>

Oh, I see. I think the Dockerfile on [GitHub - balena-io-hardware/balena-fin-coprocessor-firmata: firmata firmware for the BGM111 co-processor on the balenaFin](https://github.com/balena-io-hardware/balena-fin-coprocessor-firmata) is only meant to ease building the firmware on a local machine. Is there a particular reason you want to use the builder for this?

You might get it to build on the builder but you would have to make some changes as I think the `.git` folder is ignored by balena CLI, and the `CMD` instruction on the dockerfile is intended to run `make` on a local volume so it won’t be very helpful as is to push this image to a device.

---

<div class="post-metadata">

**Author:** ![ricardoosorio](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ricardoosorio/32/5675_2.png) [@ricardoosorio](https://forums.balena.io/u/ricardoosorio)\
**Post date:** [April 7, 2021, 9:13pm UTC](https://forums.balena.io/t/vanilla-firmware-build-fails-to-work-after-flash/284556/12 "2021-04-07T21:13:01Z")

</div>

> [@pipex](#):
>
> et it to build on the builder but you would have to make some changes as I think the `.git` folder is ignored by balena CLI, and the `CMD` instruction on the dockerfile is intended to run `make` on a local volume so it won’t be very helpful as is to push thi

I already try to build using local docker (as you can see in the begin of this thread) but the hex simply doesn’t work when flash. Therefore I try to gave a shot by building in the device itself without luck.

Our goal is: to be able to compile a firmware and flash. And seems the supported github isn’t ok.

Please check the begin of the thread

---

<div class="post-metadata">

**Author:** ![pipex](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/pipex/32/4840_2.png) [@pipex](https://forums.balena.io/u/pipex)\
**Post date:** [April 7, 2021, 9:40pm UTC](https://forums.balena.io/t/vanilla-firmware-build-fails-to-work-after-flash/284556/13 "2021-04-07T21:40:12Z")

</div>

I understand, unfortunately you won’t get the file to build on device doing `balena push` which builds on our build server.

Looking at the build logs you shared and your message at the beginning of the thread I understand that you can build and flash the firmware in the balena-fin-coprocessor-firmata repository without issues, is that correct?

Is your custom firmware based on the source in [balena-fin-coprocessor-firmata](https://github.com/balena-io-hardware/balena-fin-coprocessor-firmata)? Are you using the tools in that repository to build your custom firmware?

Is there anything else you can tell us about your custom firmware that might help us better diagnose the cause of the issue?

Thank you

---

<div class="post-metadata">

**Author:** ![ricardoosorio](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ricardoosorio/32/5675_2.png) [@ricardoosorio](https://forums.balena.io/u/ricardoosorio)\
**Post date:** [April 7, 2021, 10:44pm UTC](https://forums.balena.io/t/vanilla-firmware-build-fails-to-work-after-flash/284556/15 "2021-04-07T22:44:03Z")

</div>

1. I can build
2. I could flash (using the githup for flash)
3. But after flash, the behaviour is not right. It reboots when calling any of the firmware commands using the firmware that was build straight from the balena-fin-coprocessor-firmata repository.
4. When re-flashing with the older version (firmware 2.0.1) everything gets back to normal. So is something wrong in the balena-fin-coprocessor-firmata repository that is not ok for balena 1.1.1

---

<div class="post-metadata">

**Author:** ![klutchell](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/klutchell/32/861_2.png) [@klutchell](https://forums.balena.io/u/klutchell)\
**Post date:** [April 9, 2021, 7:04pm UTC](https://forums.balena.io/t/vanilla-firmware-build-fails-to-work-after-flash/284556/18 "2021-04-09T19:04:47Z")

</div>

Hey @ricardoosorio, while we investigate the issue with the v3.0.x release of firmata, could you try basing your changes on the v2.0.1 tagged release for now? This one we know to be stable and would be best for your changes.

---

<div class="post-metadata">

**Author:** ![ricardoosorio](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ricardoosorio/32/5675_2.png) [@ricardoosorio](https://forums.balena.io/u/ricardoosorio)\
**Post date:** [April 9, 2021, 7:46pm UTC](https://forums.balena.io/t/vanilla-firmware-build-fails-to-work-after-flash/284556/20 "2021-04-09T19:46:33Z")

</div>

We will try. Can you tell us which branch it is?

---

<div class="post-metadata">

**Author:** ![klutchell](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/klutchell/32/861_2.png) [@klutchell](https://forums.balena.io/u/klutchell)\
**Post date:** [April 9, 2021, 7:48pm UTC](https://forums.balena.io/t/vanilla-firmware-build-fails-to-work-after-flash/284556/21 "2021-04-09T19:48:52Z")

</div>

It’s actually a tag, not a branch, but you can still get that version from the git command line with `git checkout v2.0.1`.
