Betriebssystem: Debian 10.
uname -a
Linux mydebian 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64 GNU/Linux
Befolgen Sie die Anweisungen auf der Handbuch-Webseite, um das Microbit-Modul zu installieren.
https://microbit-micropython.readthedocs.io/en/latest/devguide/installation.html
sudo add-apt-repository -y ppa:team-gcc-arm-embedded
sudo add-apt-repository -y ppa:pmiller-opensource/ppa
sudo apt-get update
sudo apt-get install cmake ninja-build gcc-arm-none-eabi srecord libssl-dev
pip3 install yotta
Legen Sie die Konfiguration für module.json fest.
{
"name": "helloyotta",
"version": "0.0.0",
"description": "Hello yotta example module",
"keywords": ["example"],
"author": "James Crosby <[email protected]>",
"homepage": "http://github.com/ARMmbed/yotta",
"repository": {
"url": "[email protected]:ARMmbed/helloyotta.git",
"type": "git"
},
"license": "Apache-2.0",
"dependencies": {
"simplelog": "~0.0.0"
},
"targetDependencies": {},
"bin": "./source"
}
Erstellen der Firmware:
yt target bbc-microbit-classic-gcc-nosd
Führen Sie Yotta Update aus, um Remote-Assets abzurufen:
yt up
yt build
info: generate for target: bbc-microbit-classic-gcc-nosd 0.2.3 at /home/debian/yotta_targets/bbc-microbit-classic-gcc-nosd
warning: bin directory "source" doesn't exist but is listed in the module.json file of helloyotta 0.0.0 at /home/debian
warning: nothing to build!
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/share/cmake-3.13/Modules/CMakeForceCompiler.cmake:69 (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):
/home/debian/yotta_targets/mbed-gcc/CMake/toolchain.cmake:78 (cmake_force_c_compiler)
toolchain.cmake:8 (include)
CMakeFiles/3.13.4/CMakeSystem.cmake:6 (include)
CMakeLists.txt:97 (project)
CMake Deprecation Warning at /usr/share/cmake-3.13/Modules/CMakeForceCompiler.cmake:83 (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):
/home/debian/yotta_targets/mbed-gcc/CMake/toolchain.cmake:79 (cmake_force_cxx_compiler)
toolchain.cmake:8 (include)
CMakeFiles/3.13.4/CMakeSystem.cmake:6 (include)
CMakeLists.txt:97 (project)
Meine Hardwareinformationen:
Interface Version: 0255
Bootloader Version: 0255
Laden Sie es herunter und extrahieren Sie es:
cd microbit-samples-master
yt clean
yt build
info: generate for target: bbc-microbit-classic-gcc-nosd 0.2.3 at /home/debian/Downloads/microbit-samples-master/yotta_targets/bbc-microbit-classic-gcc-nosd
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/share/cmake-3.13/Modules/CMakeForceCompiler.cmake:69 (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):
/home/debian/Downloads/microbit-samples-master/yotta_targets/mbed-gcc/CMake/toolchain.cmake:78 (cmake_force_c_compiler)
toolchain.cmake:8 (include)
/usr/share/cmake-3.13/Modules/CMakeDetermineSystem.cmake:94 (include)
CMakeLists.txt:73 (project)
CMake Deprecation Warning at /usr/share/cmake-3.13/Modules/CMakeForceCompiler.cmake:83 (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):
/home/debian/Downloads/microbit-samples-master/yotta_targets/mbed-gcc/CMake/toolchain.cmake:79 (cmake_force_cxx_compiler)
toolchain.cmake:8 (include)
/usr/share/cmake-3.13/Modules/CMakeDetermineSystem.cmake:94 (include)
CMakeLists.txt:73 (project)
GCC version is: 7.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
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
suppressing ALL warnings from mbed-classic, ble, ble-nrf51822 & nrf51-sdk
-- Configuring done
-- Generating done
-- Build files have been written to: /home/debian/Downloads/microbit-samples-master/build/bbc-microbit-classic-gcc-nosd
[114/172] Building CXX object ym/microbit-dal/source/CMakeFiles/microbit-dal.dir/core/MicroBitHeapAllocator.cpp.o
/home/debian/Downloads/microbit-samples-master/yotta_modules/microbit-dal/source/core/MicroBitHeapAllocator.cpp: In function 'void free(void*)':
/home/debian/Downloads/microbit-samples-master/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)
^~
/home/debian/Downloads/microbit-samples-master/yotta_modules/microbit-dal/source/core/MicroBitHeapAllocator.cpp:345:10: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
*cb |= MICROBIT_HEAP_BLOCK_FREE;
^
[117/172] Building CXX object ym/microbit-dal/source/CMakeFiles/microbit-dal.dir/core/MicroBitFiber.cpp.o
/home/debian/Downloads/microbit-samples-master/yotta_modules/microbit-dal/source/core/MicroBitFiber.cpp: In function 'void scheduler_init(EventModel&)':
/home/debian/Downloads/microbit-samples-master/yotta_modules/microbit-dal/source/core/MicroBitFiber.cpp:189:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if (fiber_scheduler_running())
^~
/home/debian/Downloads/microbit-samples-master/yotta_modules/microbit-dal/source/core/MicroBitFiber.cpp:194:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
messageBus = &_messageBus;
^~~~~~~~~~
/home/debian/Downloads/microbit-samples-master/yotta_modules/microbit-dal/source/core/MicroBitFiber.cpp: In function 'int fiber_wait_for_event(uint16_t, uint16_t)':
/home/debian/Downloads/microbit-samples-master/yotta_modules/microbit-dal/source/core/MicroBitFiber.cpp:388:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if(ret == MICROBIT_OK)
^~
/home/debian/Downloads/microbit-samples-master/yotta_modules/microbit-dal/source/core/MicroBitFiber.cpp:391:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
return ret;
^~~~~~
[162/172] Building CXX object ym/microbit-dal/source/CMakeFiles/microbit-dal.dir/bluetooth/MicroBitIOPinService.cpp.o
/home/debian/Downloads/microbit-samples-master/yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp: In member function 'void MicroBitIOPinService::onDataWritten(const GattWriteCallbackParams*)':
/home/debian/Downloads/microbit-samples-master/yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:179:42: warning: array subscript is above array bounds [-Warray-bounds]
io.pin[i].getDigitalValue();
~~~~~~~~~~~~~~~~~~~~~~~~~^~
/home/debian/Downloads/microbit-samples-master/yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:182:41: warning: array subscript is above array bounds [-Warray-bounds]
io.pin[i].getAnalogValue();
~~~~~~~~~~~~~~~~~~~~~~~~^~
/home/debian/Downloads/microbit-samples-master/yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:199:41: warning: array subscript is above array bounds [-Warray-bounds]
io.pin[i].getDigitalValue();
~~~~~~~~~~~~~~~~~~~~~~~~~^~
/home/debian/Downloads/microbit-samples-master/yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:202:40: warning: array subscript is above array bounds [-Warray-bounds]
io.pin[i].getAnalogValue();
~~~~~~~~~~~~~~~~~~~~~~~~^~
/home/debian/Downloads/microbit-samples-master/yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:224:43: warning: array subscript is above array bounds [-Warray-bounds]
io.pin[pin].setAnalogValue(value);
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
/home/debian/Downloads/microbit-samples-master/yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:225:46: warning: array subscript is above array bounds [-Warray-bounds]
io.pin[pin].setAnalogPeriodUs(period);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/home/debian/Downloads/microbit-samples-master/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);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/home/debian/Downloads/microbit-samples-master/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);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/debian/Downloads/microbit-samples-master/yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp: In member function 'void MicroBitIOPinService::updateBLEInputs(bool)':
/home/debian/Downloads/microbit-samples-master/yotta_modules/microbit-dal/source/bluetooth/MicroBitIOPinService.cpp:136:50: warning: array subscript is above array bounds [-Warray-bounds]
value = io.pin[i].getDigitalValue();
~~~~~~~~~~~~~~~~~~~~~~~~~^~
/home/debian/Downloads/microbit-samples-master/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
Keine .hex-Datei gefunden.
ls build/bbc-microbit-classic-gcc-nosd
build.ninja CMakeFiles CMakeLists.txt generated source ym yotta_config.h
CMakeCache.txt cmake_install.cmake CTestTestfile.cmake rules.ninja toolchain.cmake yotta_build_info.h yotta_config.json
Jetzt in meinem Python3:
python3
Python 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import microbit
>>> dir(microbit)
['__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']
>>>
Ich kann Python3s REPL nicht für Microbit verwenden.
Antwort1
Die von Ihnen gepostete Beispielausgabe zeigt, dass das Build-System nach einem Quellverzeichnis und einer zu erstellenden Datei sucht. In diesem Fall eine CPP-Datei.
Sie haben nicht gesagt, welche Version des Micro:bit Sie verwenden. Die folgenden Vorschläge funktionieren bei mir mit v1 des Micro:bit unter Debian.
Laden Sie die Micro:bit-Beispiele aus dem Repository der Lancaster University auf GitHub herunter und entpacken Sie sie:
https://github.com/lancaster-university/microbit-samples
Im Verzeichnis „microbit-samples-master“ finden Sie eine Beispieldatei main.cpp und eine Beispieldatei .json. Im Verzeichnis „examples“ finden Sie weitere Beispieldateien .cpp.
Im Verzeichnis „microbit-samples-master“:
yt target bbc-microbit-classic-gcc-nosd
yt clean
yt build
Die .hex-Datei finden Sie unter:
microbit-samples-master/build/bbc-microbit-classic-gcc/source