Hmmm... Happened to get this chance of playing with micro:bit for fun, then take this
opportunity to write a blog. It seems this BBC products is very
convenient. Let's just plug and play.
1. Introduction
1.1 lsusb
Just plug in and lsusb.
1 2 3
...... Bus 001 Device 008: ID 0d28:0204 NXP LPC1768 ......
port is : /dev/ttyACM0 flowcontrol : none baudrate is : 115200 parity is : none databits are : 8 stopbits are : 1 escape is : C-a local echo is : no noinit is : no noreset is : no nolock is : no send_cmd is : sz -vv receive_cmd is : rz -vv -E imap is : omap is : emap is : crcrlf,delbs,
Type [C-a] [C-h] to see available commands
Terminal ready
*** Picocom commands (all prefixed by [C-a])
*** [C-x] : Exit picocom *** [C-q] : Exit without reseting serial port *** [C-b] : Set baudrate *** [C-u] : Increase baudrate (baud-up) *** [C-d] : Decrease baudrate (baud-down) *** [C-i] : Change number of databits *** [C-j] : Change number of stopbits *** [C-f] : Change flow-control mode *** [C-y] : Change parity mode *** [C-p] : Pulse DTR *** [C-t] : Toggle DTR *** [C-|] : Send break *** [C-c] : Toggle local echo *** [C-s] : Send file *** [C-r] : Receive file *** [C-v] : Show port settings *** [C-h] : Show this message
Oh, my god... why can't I just code directly
here from within the console??? That's ABSOLUTELY NOT my
style.
As mentioned above, the UNACCEPTABLE thing
is: it seems we have to use micro:bit Python IDE for python
coding for micro:bit????? Anyway, my generated
HEX of Hello World is here.
141 î‚° ✔ î‚° cd microbit-samples/ 142 î‚° î‚ master î‚° ✔ î‚° ls debugOnVisualStudioCode.gif* LICENSE* module.json* README.md* source/ 143 î‚° î‚ master î‚° ✔ î‚° yt target bbc-microbit-classic-gcc info: get versions for bbc-microbit-classic-gcc info: download bbc-microbit-classic-gcc@0.2.3 from the public module registry info: get versions for mbed-gcc info: download mbed-gcc@0.1.3 from the public module registry 144 î‚° î‚ master î‚° ✔ î‚° yt build info: get versions for microbit info: download microbit@v2.1.1 from GitHub lancaster-university/microbit info: get versions for microbit-dal info: download microbit-dal@v2.1.1 from GitHub lancaster-university/microbit-dal info: get versions for mbed-classic info: download mbed-classic@microbit_hfclk+mb6 from GitHub lancaster-university/mbed-classic info: get versions for ble info: download ble@v2.5.0+mb3 from GitHub lancaster-university/BLE_API info: get versions for ble-nrf51822 info: download ble-nrf51822@v2.5.0+mb7 from GitHub lancaster-university/nRF51822 info: get versions for nrf51-sdk info: download nrf51-sdk@v2.2.0+mb4 from GitHub lancaster-university/nrf51-sdk info: generate for target: bbc-microbit-classic-gcc 0.2.3 at ....../microbit-samples/yotta_targets/bbc-microbit-classic-gcc CMake Deprecation Warning at CMakeLists.txt:16 (cmake_policy): The OLD behavior for policy CMP0017 will be removed from a future version of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD.
CMake Deprecation Warning at /usr/local/share/cmake-3.17/Modules/CMakeForceCompiler.cmake:75 (message): The CMAKE_FORCE_C_COMPILER macro is deprecated. Instead just set CMAKE_C_COMPILER and allow CMake to identify the compiler. Call Stack (most recent call first): ....../microbit-samples/yotta_targets/mbed-gcc/CMake/toolchain.cmake:78 (cmake_force_c_compiler) toolchain.cmake:8 (include) /usr/local/share/cmake-3.17/Modules/CMakeDetermineSystem.cmake:93 (include) CMakeLists.txt:76 (project)
CMake Deprecation Warning at /usr/local/share/cmake-3.17/Modules/CMakeForceCompiler.cmake:89 (message): The CMAKE_FORCE_CXX_COMPILER macro is deprecated. Instead just set CMAKE_CXX_COMPILER and allow CMake to identify the compiler. Call Stack (most recent call first): ....../microbit-samples/yotta_targets/mbed-gcc/CMake/toolchain.cmake:79 (cmake_force_cxx_compiler) toolchain.cmake:8 (include) /usr/local/share/cmake-3.17/Modules/CMakeDetermineSystem.cmake:93 (include) CMakeLists.txt:76 (project)
GCC version is: 6.3.1 -- The ASM compiler identification is GNU -- Found assembler: /usr/bin/arm-none-eabi-gcc suppressing warnings from ble-nrf51822 suppressing warnings from nrf51-sdk suppressing ALL warnings from mbed-classic, ble, ble-nrf51822 & nrf51-sdk -- Configuring done -- Generating done -- Build files have been written to: ....../microbit-samples/build/bbc-microbit-classic-gcc [112/172] Building CXX object ym/microbit-dal/source/CMakeFiles/microbit-dal.dir/core/MicroBitHeapAllocator.cpp.o ....../microbit-samples/yotta_modules/microbit-dal/source/core/MicroBitHeapAllocator.cpp: In function 'void free(void*)': ....../microbit-samples/yotta_modules/microbit-dal/source/core/MicroBitHeapAllocator.cpp:342:13: warning: this 'if' clause does not guard... [-Wmisleading-indentation] if (*cb == 0 || *cb & MICROBIT_HEAP_BLOCK_FREE) ^~ ....../microbit-samples/yotta_modules/microbit-dal/source/core/MicroBitHeapAllocator.cpp:345:10: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' *cb |= MICROBIT_HEAP_BLOCK_FREE; ^ [120/172] Building CXX object ym/microbit-dal/source/CMakeFiles/microbit-dal.dir/core/MicroBitFiber.cpp.o ....../microbit-samples/yotta_modules/microbit-dal/source/core/MicroBitFiber.cpp: In function 'void scheduler_init(EventModel&)': ....../microbit-samples/yotta_modules/microbit-dal/source/core/MicroBitFiber.cpp:189:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation] if (fiber_scheduler_running()) ^~ ....../microbit-samples/yotta_modules/microbit-dal/source/core/MicroBitFiber.cpp:194:2: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' messageBus = &_messageBus; ^~~~~~~~~~ ....../microbit-samples/yotta_modules/microbit-dal/source/core/MicroBitFiber.cpp: In function 'int fiber_wait_for_event(uint16_t, uint16_t)': ....../microbit-samples/yotta_modules/microbit-dal/source/core/MicroBitFiber.cpp:388:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation] if(ret == MICROBIT_OK) ^~ ....../microbit-samples/yotta_modules/microbit-dal/source/core/MicroBitFiber.cpp:391:2: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' return ret; ^~~~~~ [159/172] Building CXX object ym/microbit-dal/source/CMakeFiles/microbit-dal.dir/bluetooth/MicroBitIOPinService.cpp.o ....../microbit-samples/yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp: In member function 'void MicroBitIOPinService::onDataWritten(const GattWriteCallbackParams*)': ....../microbit-samples/yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:179:42: warning: array subscript is above array bounds [-Warray-bounds] io.pin[i].getDigitalValue(); ~~~~~~~~~~~~~~~~~~~~~~~~~^~ ....../microbit-samples/yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:182:41: warning: array subscript is above array bounds [-Warray-bounds] io.pin[i].getAnalogValue(); ~~~~~~~~~~~~~~~~~~~~~~~~^~ ....../microbit-samples/yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:199:41: warning: array subscript is above array bounds [-Warray-bounds] io.pin[i].getDigitalValue(); ~~~~~~~~~~~~~~~~~~~~~~~~~^~ ....../microbit-samples/yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:202:40: warning: array subscript is above array bounds [-Warray-bounds] io.pin[i].getAnalogValue(); ~~~~~~~~~~~~~~~~~~~~~~~~^~ ....../microbit-samples/yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:224:43: warning: array subscript is above array bounds [-Warray-bounds] io.pin[pin].setAnalogValue(value); ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ ....../microbit-samples/yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:225:46: warning: array subscript is above array bounds [-Warray-bounds] io.pin[pin].setAnalogPeriodUs(period); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ ....../microbit-samples/yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:245:51: warning: array subscript is above array bounds [-Warray-bounds] io.pin[data->pin].setDigitalValue(data->value); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~ ....../microbit-samples/yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:247:50: warning: array subscript is above array bounds [-Warray-bounds] io.pin[data->pin].setAnalogValue(data->value == 255 ? 1023 : data->value << 2); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ....../microbit-samples/yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp: In member function 'void MicroBitIOPinService::updateBLEInputs(bool)': ....../microbit-samples/yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:136:50: warning: array subscript is above array bounds [-Warray-bounds] value = io.pin[i].getDigitalValue(); ~~~~~~~~~~~~~~~~~~~~~~~~~^~ ....../microbit-samples/yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:138:49: warning: array subscript is above array bounds [-Warray-bounds] value = io.pin[i].getAnalogValue() >> 2; ~~~~~~~~~~~~~~~~~~~~~~~~^~ [172/172] Linking CXX executable source/microbit-samples /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/thumb/v6-m/libstdc++_nano.a(atexit_arm.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/thumb/v6-m/libstdc++_nano.a(new_opv.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/thumb/v6-m/libstdc++_nano.a(del_opv.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/thumb/v6-m/libstdc++_nano.a(del_op.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/thumb/v6-m/libstdc++_nano.a(new_op.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: warning: /usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/thumb/v6-m/libstdc++_nano.a(new_handler.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail 145 î‚° î‚ master î‚° ✘ î‚° cp ./build/bbc-microbit-classic-gcc/source/microbit-samples-combined.hex /media/longervision/MICROBIT 146 î‚° î‚ master î‚° ✔ î‚°