Ada on the BBC micro:bit

Screenshot Linux view of BBC micro:bit

Ada on BBC micro:bit
with respect to Linux
ensure that /home/mikeh/opt/GNAT/2019/bin or similar is in the PATH environment variable.

download native and ARM-ELF versions

gprbuild --target=arm-eabi -d -P/home/mike/AdaDemo1/microbit_example.gpr /home/mike/AdaDemo1/src/main.adb -largs -Wl,-Map=map.txt
gprbuild: "main" up to date
[2019-10-08 20:21:08] process terminated successfully, elapsed time: 00.53s
Retrieving the load address.
arm-eabi-objdump /home/mike/AdaDemo1/obj/main -h
Load address is: 0x00000000
Creating the binary (flashable) image.
arm-eabi-objcopy -O binary /home/mike/AdaDemo1/obj/main /home/mike/AdaDemo1/obj/main.bin
Flashing image to board...
pyocd-flashtool -a 0x00000000 /home/mike/AdaDemo1/obj/main.bin
WARNING:root:Unsupported board found 9901
INFO:root:DAP SWD MODE initialised
INFO:root:ROM table #0 @ 0xf0000000 cidr=b105100d pidr=2007c4001
INFO:root:[0]
INFO:root:ROM table #1 @ 0xe00ff000 cidr=b105100d pidr=4000bb471
INFO:root:[0]
INFO:root:[1]
INFO:root:[2]
INFO:root:[1]
INFO:root:CPU core is Cortex-M0
INFO:root:4 hardware breakpoints, 0 literal comparators
INFO:root:2 hardware watchpoints
Traceback (most recent call last):
File "/home/mike/opt/GNAT/2019/bin/pyocd-flashtool", line 11, in
sys.exit(main())
File "/home/mike/opt/GNAT/2019/lib/python2.7/site-packages/pyOCD/tools/flash_tool.py", line 214, in main
fast_verify=args.fast_program)
File "/home/mike/opt/GNAT/2019/lib/python2.7/site-packages/pyOCD/flash/flash.py", line 286, in flashBlock
flash_start = self.getFlashInfo().rom_start
File "/home/mike/opt/GNAT/2019/lib/python2.7/site-packages/pyOCD/flash/flash_cortex_m.py", line 44, in getFlashInfo
raise Exception("Unsupported flash operation on generic cortex_m")
Exception: Unsupported flash operation on generic cortex_m
Could not flash the executable.
[workflow stopped]

see Adacore blog about BBC micro:bit
Here are the contents of the DETAILS.TXT file easily accessible from the BBC micro:bit. Note the occurrence of 9901

# DAPLink Firmware - see https://mbed.com/daplink
Unique ID: 9901000052284e4500493011000000070000000097969901
HIC ID: 97969901
Auto Reset: 1
Automation allowed: 0
Overflow detection: 0
Daplink Mode: Interface
Interface Version: 0249
Bootloader Version: 0243
Git SHA: 9c5fd81e6545d00b7f7c21ca9d8577dbd6a5fed2
Local Mods: 0
USB Interfaces: MSD, CDC, HID, WebUSB
Bootloader CRC: 0x32eb3cfd
Interface CRC: 0xcdb7b2a3
Remount count: 0
URL: https://microbit.org/device/?id=9901&v=0249

Note that the Serial Number below contains the 'magic' 9901 a.k.a. Unique ID

kern :info : [Tue Nov 12 16:20:38 2019] usb 1-8.2: new full-speed USB device number 6 using ehci-pci
kern :info : [Tue Nov 12 16:20:38 2019] usb 1-8.2: New USB device found, idVendor=0d28, idProduct=0204
kern :info : [Tue Nov 12 16:20:38 2019] usb 1-8.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
kern :info : [Tue Nov 12 16:20:38 2019] usb 1-8.2: Product: BBC micro:bit CMSIS-DAP
kern :info : [Tue Nov 12 16:20:38 2019] usb 1-8.2: Manufacturer: ARM
kern :info : [Tue Nov 12 16:20:38 2019] usb 1-8.2: SerialNumber: 9901000052284e4500493011000000070000000097969901
kern :info : [Tue Nov 12 16:20:38 2019] hid-generic 0003:0D28:0204.0004: hiddev0,hidraw3: USB HID v1.00 Device [ARM BBC micro:bit CMSIS-DAP] on usb-0000:00:1d.7-8.2/input3
kern :info : [Tue Nov 12 16:20:38 2019] cdc_acm 1-8.2:1.1: ttyACM0: USB ACM device
>/code>