yt 빌드의 소스를 설정하는 방법은 무엇입니까?

yt 빌드의 소스를 설정하는 방법은 무엇입니까?

운영체제: debian10.

uname -a
Linux mydebian 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64 GNU/Linux

마이크로비트 모듈을 설치하는 방법은 매뉴얼 웹페이지에 나와 있는 대로 수행하십시오.

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

module.json에 대한 구성을 설정합니다.

{
  "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"
}

펌웨어 구축:

yt target bbc-microbit-classic-gcc-nosd

yotta update를 실행하여 원격 자산을 가져옵니다.

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)

내 하드웨어 정보:

Interface Version: 0255
Bootloader Version: 0255

다운로드하고 추출하세요.

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
 

.hex 파일이 없습니다.

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

이제 내 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__']
>>> 

마이크로비트에는 python3의 REPL을 사용할 수 없습니다.

답변1

게시한 샘플 출력은 빌드 시스템이 '소스' 디렉터리와 빌드할 파일을 찾고 있음을 보여줍니다. 이 경우 .cpp 파일입니다.

사용 중인 micro:bit 버전을 밝히지 않았습니다. 다음 제안은 Debian에서 micro:bit v1을 사용하는 데 효과적입니다.

GitHub의 Lancaster University 저장소에서 micro:bit 예제를 다운로드하고 압축을 풉니다.

https://github.com/lancaster-university/microbit-samples

microbit-samples-master 디렉터리에 예제 main.cpp 파일과 .json 파일이 있습니다. 예제 디렉터리에는 다른 예제 .cpp 파일이 있습니다.

microbit-samples-master 디렉터리에서:

yt target bbc-microbit-classic-gcc-nosd
yt clean
yt build

.hex 파일은 다음 위치에서 찾을 수 있습니다.

microbit-samples-master/build/bbc-microbit-classic-gcc/source

관련 정보