Sign in Join
Wiki copytemporary

micro:bit: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11The micro:bit is a small embedded system equipped with a Nordic Semiconductor nRF51822 controller based on the Cortex-M0 architecture. With FPC trunk, it is possible to build programs for it. Follow the instructions at [Embedded ARM](http://wiki.freepascal.org/TARGET_Embedded#ARM_Embedded) to setup FPC for the target arm-embedded. However, do not use the provided command line to build and install FPC but use
22
3-` make clean buildbase installbase CROSSINSTALL=1 OS_TARGET=embedded CPU_TARGET=arm SUBARCH=armv6m`
3+```text
4+ make clean buildbase installbase CROSSINSTALL=1 OS_TARGET=embedded CPU_TARGET=arm SUBARCH=armv6m
5+```
46
57instead to build FPC for the controller used by the micro:bit.
68
79Now enter the following program:
810
911``` pascal
1012 const
1113 GPIO_PIN_CNF_INPUT_Disconnect = 1;
1214 GPIO_PIN_CNF_DIR_Output = 1;
1315 microbit_led_col1 = 4;
1416 microbit_led_row1 = 13;
1517 var
1618 i : longint;
1719 begin
1820 GPIO.PIN_CNF[microbit_led_col1]:=(GPIO_PIN_CNF_INPUT_Disconnect shl 1) or GPIO_PIN_CNF_DIR_Output;
1921 GPIO.PIN_CNF[microbit_led_row1]:=(GPIO_PIN_CNF_INPUT_Disconnect shl 1) or GPIO_PIN_CNF_DIR_Output;
2022 while true do
2123 begin
2224 GPIO.OUTSET:=1 shl microbit_led_row1;
2325 GPIO.OUTCLR:=1 shl microbit_led_col1;
2426 for i:=1 to 500000 do
2527 asm
2628 nop
2729 end;
2830 GPIO.OUTCLR:=1 shl microbit_led_row1;
2931 for i:=1 to 500000 do
3032 asm
3133 nop
3234 end;
3335 end;
3436 end.
3537```
3638
3739save it as example.pp and compile it with:
3840
39-` fpc -Parm -Tembedded -Wpnrf51822_xxaa example -Cparmv6m`
41+```text
42+ fpc -Parm -Tembedded -Wpnrf51822_xxaa example -Cparmv6m
43+```
4044
4145When connecting a micro:bit to PC, it identifies itself as an USB drive. Find out where this drive is located and copy the resulting example.hex to this drive.
4246
4347If everything worked fine, the upper left LED will blink.
4448
4549---
4650*From the Free Pascal wiki, page "micro:bit", as it stood on 2019-12-17 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
4751Category: ARM
4852Category: Embedded
4953Category: Microcontrollers
5054Category: Operating Systems and Platforms

Back to history