Forum > Embedded

Micro:Bit tutorial on wiki does not seem to work

(1/1)

kveroneau:
Okay, so I had a Micro:bit for awhile, and decided I wanted to take it to the next level and try using FreePascal to build programs for it.  I followed the following Wiki page: https://wiki.lazarus.freepascal.org/micro:bit

I followed the wiki to generate the following Dockerfile, which gives me a working binutils, and appears to compile FreePascal with no issues.  The first problem I had was that when I went to execute the compile command to build the example from the wiki, I got the following error:


--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---root@6828c28f1661:~# fpc -Parm -Tembedded -Wpnrf51822_xxaa test -Cparmv6mError: ppcarm can't be executed, error message: Failed to execute "ppcarm", error code: 127 
Okay, so I thought that perhaps the make command didn't put the needed binary into place, so I did the following:


--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---ln -s /usr/lib/fpc/3.0.4/ppcrossarm /usr/bin/ppcarm 
I once again tried the compile command, and received another error:


--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---root@6828c28f1661:~# fpc -Parm -Tembedded -Wpnrf51822_xxaa test -Cparmv6mError: Illegal parameter: -Wpnrf51822_xxaaError: /usr/bin/ppcarm returned an error exitcode 
At first I swapped out -Wpnrf51822_xxaa with -WPnrf51822_xxaa thinking that -WP needed to be capitalized, the same error occurred.  I then went and ran fpc -i and in the list of Supported Microcontroller types, I do not see it there.  I am currently using FPC 3.0.4, as I thought it would be in a stable FPC source release, as the wiki article dates back to 2017, so surely the microcontroller would be in the latest version of FPC now.  Is this microcontroller still only available in FPC trunk?

Here's my current Dockerfile(will change before I make it available to anyone who might want it):


--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---FROM kveroneau/fpc:3.0.4-amd64 RUN apt-get update && apt-get -y install wget build-essential RUN wget -O /tmp/fpc-source.tgz ftp://mirror.freemirror.org/pub/fpc/dist/3.0.4/source/fpc-3.0.4.source.tar.gz && cd /usr/src && tar -xzvf /tmp/fpc-source.tgz && rm -rf /tmp/fpc-source.tgz RUN wget -O /tmp/binutils.tgz https://gnu.freemirror.org/gnu/binutils/binutils-2.28.1.tar.gz && cd /usr/src && tar -xzvf /tmp/binutils.tgz && rm -rf /tmp/binutils.tgz RUN cd /usr/src/binutils-2.28.1 && ./configure --target=arm-linux --prefix=/opt/binutils --program-prefix=arm-embedded- --disable-werror && make && make install ENV PATH /opt/binutils/bin:/usr/sbin:/usr/bin:/sbin:/bin RUN cd /usr/src/fpc-3.0.4 && make clean buildbase installbase CROSSINSTALL=1 OS_TARGET=embedded CPU_TARGET=arm SUBARCH=armv6m INSTALL_PREFIX=/usr 
Great part about Docker here is that I can 100% create a reproducible build for anyone in these forums to try out and see the problem firsthand.  :D

I committed my current Dockerfile here, if anyone wants to play around and potentially get it working, https://github.com/kveroneau/fpc-docker/tree/master/Builder/fpc-microbit

MiR:
When I am not mistaken the unit files for the nrf chips are only in trunk.

So you will need to compile a cross compiler based on trunk and then use that one to compile your sample code

Michael

julkas:

--- Quote from: MiR on December 22, 2019, 12:07:56 am ---When I am not mistaken the unit files for the nrf chips are only in trunk.

So you will need to compile a cross compiler based on trunk and then use that one to compile your sample code

Michael

--- End quote ---
Yes, you must build cross compiler for your target from trunk.
BTW - Good idea - small Docker image for FPC embedded dev.

Navigation

[0] Message Index

Go to full version