How to build MicroPython for Pico (rp2)?

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
Post Reply
HermannSW
Posts: 181
Joined: Wed Nov 01, 2017 7:46 am
Contact:

How to build MicroPython for Pico (rp2)?

Post by HermannSW » Wed Mar 03, 2021 10:02 pm

I was able to build MicroPython when having cloned from raspberrpi github some time ago.

Today I cloned from here:
https://github.com/micropython/micropython

I did replace micropython/lib/pico-sdk with symbolic link to ~/pico/pico-sdk.
After "make -C mpy-cross" I CDed into ports/rp2.
After "make clean" the following "time make" errors on including tusb.h:

Code: Select all

pi@raspberrypi400:~/pico/micropython/ports/rp2 $ time make
[ -d build ] || cmake -S . -B build -DPICO_BUILD_DOCS=0
PICO_SDK_PATH is /home/pi/pico/micropython/lib/pico-sdk
Defaulting PICO_PLATFORM to rp2040 since not specified.
Defaulting PICO platform compiler to pico_arm_gcc since not specified.
PICO compiler is pico_arm_gcc
PICO_GCC_TRIPLE defaulted to arm-none-eabi
-- The C compiler identification is GNU 7.3.1
-- The CXX compiler identification is GNU 7.3.1
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/arm-none-eabi-gcc
Defaulting PICO target board to pico since not specified.
Using board configuration from /home/pi/pico/micropython/lib/pico-sdk/src/boards/include/boards/pico.h
-- Found Python3: /usr/bin/python3.7 (found version "3.7.3") found components:  Interpreter 
CMake Warning at /home/pi/pico/micropython/lib/pico-sdk/src/rp2_common/tinyusb/CMakeLists.txt:14 (message):
  PICO_TINYUSB_PATH specified but content not present.


-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
Using PICO_EXAMPLES_PATH from environment ('/home/pi/pico/pico-examples')
ELF2UF2 will need to be built
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/pico/micropython/ports/rp2/build
make -s -C build
Scanning dependencies of target bs2_default
[  0%] Building ASM object pico-sdk/src/rp2_common/boot_stage2/CMakeFiles/bs2_default.dir/boot2_w25q080.S.obj
[  0%] Linking ASM executable bs2_default.elf
[  0%] Built target bs2_default
Scanning dependencies of target bs2_default_padded_checksummed_asm
[  0%] Generating bs2_default.bin
[  0%] Generating bs2_default_padded_checksummed.S
[  0%] Built target bs2_default_padded_checksummed_asm
Scanning dependencies of target ELF2UF2Build
[  1%] Creating directories for 'ELF2UF2Build'
[  1%] No download step for 'ELF2UF2Build'
[  2%] No patch step for 'ELF2UF2Build'
[  2%] No update step for 'ELF2UF2Build'
[  2%] Performing configure step for 'ELF2UF2Build'
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/pico/micropython/ports/rp2/build/elf2uf2
[  3%] Performing build step for 'ELF2UF2Build'
Scanning dependencies of target elf2uf2
[ 50%] Building CXX object CMakeFiles/elf2uf2.dir/main.cpp.o
[100%] Linking CXX executable elf2uf2
[100%] Built target elf2uf2
[  3%] No install step for 'ELF2UF2Build'
[  3%] Completed 'ELF2UF2Build'
[  3%] Built target ELF2UF2Build
[  4%] Generating genhdr/mpversion.h
GEN /home/pi/pico/micropython/ports/rp2/build/genhdr/mpversion.h
[  4%] Generating genhdr/moduledefs.h
[  4%] Generating genhdr/qstr.i.last
[  5%] Generating genhdr/qstr.split
[  5%] Generating genhdr/qstrdefs.collected.h
QSTR updated
[  5%] Generating genhdr/qstrdefs.preprocessed.h
[  5%] Generating genhdr/qstrdefs.generated.h
[  6%] Generating frozen_content.c
MPY _boot.py
MPY rp2.py
MPY onewire.py
MPY ds18x20.py
MPY uasyncio/__init__.py
MPY uasyncio/core.py
MPY uasyncio/event.py
MPY uasyncio/funcs.py
MPY uasyncio/lock.py
MPY uasyncio/stream.py
GEN /home/pi/pico/micropython/ports/rp2/build/frozen_content.c
Scanning dependencies of target firmware
[  6%] Generating genhdr/mpversion.h
[  6%] Generating frozen_content.c
[  7%] Building C object CMakeFiles/firmware.dir/frozen_content.c.obj
[  7%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/argcheck.c.obj
[  8%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/asmarm.c.obj
[  8%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/asmbase.c.obj
[  8%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/asmthumb.c.obj
[  9%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/asmx64.c.obj
[  9%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/asmx86.c.obj
[  9%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/asmxtensa.c.obj
[ 10%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/bc.c.obj
[ 10%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/binary.c.obj
[ 11%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/builtinevex.c.obj
[ 11%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/builtinhelp.c.obj
[ 11%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/builtinimport.c.obj
[ 12%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/compile.c.obj
[ 12%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/emitbc.c.obj
[ 13%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/emitcommon.c.obj
[ 13%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/emitglue.c.obj
[ 13%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/emitinlinethumb.c.obj
[ 14%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/emitinlinextensa.c.obj
[ 14%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/emitnarm.c.obj
[ 14%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/emitnthumb.c.obj
[ 15%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/emitnx64.c.obj
[ 15%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/emitnx86.c.obj
[ 16%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/emitnxtensa.c.obj
[ 16%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/emitnxtensawin.c.obj
[ 16%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/formatfloat.c.obj
[ 17%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/frozenmod.c.obj
[ 17%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/gc.c.obj
[ 17%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/lexer.c.obj
[ 18%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/malloc.c.obj
[ 18%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/map.c.obj
[ 19%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/modarray.c.obj
[ 19%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/modbuiltins.c.obj
[ 19%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/modcmath.c.obj
[ 20%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/modcollections.c.obj
[ 20%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/modgc.c.obj
[ 20%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/modio.c.obj
[ 21%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/modmath.c.obj
[ 21%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/modmicropython.c.obj
[ 22%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/modstruct.c.obj
[ 22%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/modsys.c.obj
[ 22%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/modthread.c.obj
[ 23%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/moduerrno.c.obj
[ 23%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/mpprint.c.obj
[ 24%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/mpstate.c.obj
[ 24%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/mpz.c.obj
[ 24%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/nativeglue.c.obj
[ 25%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/nlr.c.obj
[ 25%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/nlrpowerpc.c.obj
[ 25%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/nlrsetjmp.c.obj
[ 26%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/nlrthumb.c.obj
[ 26%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/nlrx64.c.obj
[ 27%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/nlrx86.c.obj
[ 27%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/nlrxtensa.c.obj
[ 27%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/obj.c.obj
[ 28%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objarray.c.obj
[ 28%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objattrtuple.c.obj
[ 28%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objbool.c.obj
[ 29%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objboundmeth.c.obj
[ 29%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objcell.c.obj
[ 30%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objclosure.c.obj
[ 30%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objcomplex.c.obj
[ 30%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objdeque.c.obj
[ 31%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objdict.c.obj
[ 31%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objenumerate.c.obj
[ 31%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objexcept.c.obj
[ 32%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objfilter.c.obj
[ 32%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objfloat.c.obj
[ 33%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objfun.c.obj
[ 33%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objgenerator.c.obj
[ 33%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objgetitemiter.c.obj
[ 34%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objint.c.obj
[ 34%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objint_longlong.c.obj
[ 34%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objint_mpz.c.obj
[ 35%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objlist.c.obj
[ 35%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objmap.c.obj
[ 36%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objmodule.c.obj
[ 36%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objnamedtuple.c.obj
[ 36%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objnone.c.obj
[ 37%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objobject.c.obj
[ 37%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objpolyiter.c.obj
[ 38%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objproperty.c.obj
[ 38%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objrange.c.obj
[ 38%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objreversed.c.obj
[ 39%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objset.c.obj
[ 39%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objsingleton.c.obj
[ 39%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objslice.c.obj
[ 40%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objstr.c.obj
[ 40%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objstringio.c.obj
[ 41%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objstrunicode.c.obj
[ 41%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objtuple.c.obj
[ 41%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objtype.c.obj
[ 42%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/objzip.c.obj
[ 42%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/opmethods.c.obj
[ 42%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/pairheap.c.obj
[ 43%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/parse.c.obj
[ 43%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/parsenum.c.obj
[ 44%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/parsenumbase.c.obj
[ 44%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/persistentcode.c.obj
[ 44%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/profile.c.obj
[ 45%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/pystack.c.obj
[ 45%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/qstr.c.obj
[ 45%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/reader.c.obj
[ 46%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/repl.c.obj
[ 46%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/ringbuf.c.obj
[ 47%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/runtime.c.obj
[ 47%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/runtime_utils.c.obj
[ 47%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/scheduler.c.obj
[ 48%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/scope.c.obj
[ 48%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/sequence.c.obj
[ 49%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/showbc.c.obj
[ 49%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/smallint.c.obj
[ 49%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/stackctrl.c.obj
[ 50%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/stream.c.obj
[ 50%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/unicode.c.obj
[ 50%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/vm.c.obj
[ 51%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/vstr.c.obj
[ 51%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/py/warning.c.obj
[ 52%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/machine_i2c.c.obj
[ 52%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/machine_mem.c.obj
[ 52%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/machine_pulse.c.obj
[ 53%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/machine_signal.c.obj
[ 53%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/machine_spi.c.obj
[ 53%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/modbtree.c.obj
[ 54%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/modframebuf.c.obj
[ 54%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/modonewire.c.obj
[ 55%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/moduasyncio.c.obj
[ 55%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/modubinascii.c.obj
[ 55%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/moducryptolib.c.obj
[ 56%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/moductypes.c.obj
[ 56%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/moduhashlib.c.obj
[ 56%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/moduheapq.c.obj
[ 57%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/modujson.c.obj
[ 57%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/modurandom.c.obj
[ 58%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/modure.c.obj
[ 58%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/moduselect.c.obj
[ 58%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/modussl_axtls.c.obj
[ 59%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/modussl_mbedtls.c.obj
[ 59%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/modutimeq.c.obj
[ 59%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/moduwebsocket.c.obj
[ 60%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/moduzlib.c.obj
[ 60%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/modwebrepl.c.obj
[ 61%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/uos_dupterm.c.obj
[ 61%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/utime_mphal.c.obj
[ 61%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/vfs.c.obj
[ 62%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/vfs_blockdev.c.obj
[ 62%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/vfs_fat.c.obj
[ 63%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/vfs_fat_diskio.c.obj
[ 63%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/vfs_fat_file.c.obj
[ 63%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/vfs_lfs.c.obj
[ 64%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/vfs_posix.c.obj
[ 64%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/vfs_posix_file.c.obj
[ 64%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/vfs_reader.c.obj
[ 65%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/extmod/virtpin.c.obj
[ 65%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/lib/littlefs/lfs1.c.obj
[ 66%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/lib/littlefs/lfs1_util.c.obj
[ 66%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/lib/littlefs/lfs2.c.obj
[ 66%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/lib/littlefs/lfs2_util.c.obj
[ 67%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/lib/mp-readline/readline.c.obj
[ 67%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/lib/oofatfs/ff.c.obj
[ 67%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/lib/oofatfs/ffunicode.c.obj
[ 68%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/lib/timeutils/timeutils.c.obj
[ 68%] Building ASM object CMakeFiles/firmware.dir/home/pi/pico/micropython/lib/utils/gchelper_m0.s.obj
[ 69%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/lib/utils/gchelper_native.c.obj
[ 69%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/lib/utils/mpirq.c.obj
[ 69%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/lib/utils/stdout_helpers.c.obj
[ 70%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/lib/utils/sys_stdio_mphal.c.obj
[ 70%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/lib/utils/pyexec.c.obj
[ 70%] Building C object CMakeFiles/firmware.dir/home/pi/pico/micropython/drivers/bus/softspi.c.obj
[ 71%] Building C object CMakeFiles/firmware.dir/machine_adc.c.obj
[ 71%] Building C object CMakeFiles/firmware.dir/machine_i2c.c.obj
[ 72%] Building C object CMakeFiles/firmware.dir/machine_pin.c.obj
[ 72%] Building C object CMakeFiles/firmware.dir/machine_pwm.c.obj
[ 72%] Building C object CMakeFiles/firmware.dir/machine_spi.c.obj
[ 73%] Building C object CMakeFiles/firmware.dir/machine_timer.c.obj
[ 73%] Building C object CMakeFiles/firmware.dir/machine_uart.c.obj
[ 74%] Building C object CMakeFiles/firmware.dir/machine_wdt.c.obj
[ 74%] Building C object CMakeFiles/firmware.dir/main.c.obj
/home/pi/pico/micropython/ports/rp2/main.c:37:10: fatal error: tusb.h: No such file or directory
 #include "tusb.h"
          ^~~~~~~~
compilation terminated.
make[3]: *** [CMakeFiles/firmware.dir/build.make:2734: CMakeFiles/firmware.dir/main.c.obj] Error 1
make[2]: *** [CMakeFiles/Makefile2:74: CMakeFiles/firmware.dir/all] Error 2
make[1]: *** [Makefile:84: all] Error 2
make: *** [Makefile:11: all] Error 2

real	1m23.237s
user	0m57.402s
sys	0m22.252s
pi@raspberrypi400:~/pico/micropython/ports/rp2 $ 

What am I doing wrong?
Where are instructions how to build MicroPython for Pico (rp2) with all steps needed?
Pico (USB) reboot/reflash tool
https://gist.github.com/Hermann-SW/ca07 ... 6d81de01a7

Pico HTTPS GET through ESP01 serial2wifi
viewtopic.php?f=21&t=10122

Wireless Pico Micropython REPL
viewtopic.php?f=21&t=10109

taPIQoLEHUMA
Posts: 8
Joined: Thu Mar 04, 2021 2:59 am

Re: How to build MicroPython for Pico (rp2)?

Post by taPIQoLEHUMA » Thu Mar 04, 2021 3:09 am

This is what worked for me... if I didn't mess up the copy + paste:

Code: Select all

  git clone https://www.github.com/micropython/micropython
  cd micropython/
  make -C mpy-cross/
  git submodule update --init -- lib/pico-sdk
  git submodule update --init -- lib/tinyusb
  cd lib/pico-sdk
  git submodule update --init
  cd ../..
  cd ports/rp2
  make -j4
  picotool info -a build/firmware.uf2 
I'm not sure where I found those extra steps to update the submodules...

st42
Posts: 1
Joined: Thu Mar 04, 2021 4:05 am

Re: How to build MicroPython for Pico (rp2)?

Post by st42 » Thu Mar 04, 2021 4:10 am

The instructions for building micropython from source is in https://datasheets.raspberrypi.org/pico ... on-sdk.pdf

HermannSW
Posts: 181
Joined: Wed Nov 01, 2017 7:46 am
Contact:

Re: How to build MicroPython for Pico (rp2)?

Post by HermannSW » Thu Mar 04, 2021 4:37 pm

Thanks @st42, I followed the instructions and it worked well.
I have built Micropython some time ago, perhaps following those instructions.

@taPIQoLEHUMA your steps update submodule lib/pico-sdk twice.
But I took the "-j4" from your last step, works well, and in "1.3. Building MicroPython From Source" they use "make".

I did build on Pi400 with SD card, Building mpy-cross took 42 seconds, building in ports/rp2 took 52 seconds (with -j4).
Pico (USB) reboot/reflash tool
https://gist.github.com/Hermann-SW/ca07 ... 6d81de01a7

Pico HTTPS GET through ESP01 serial2wifi
viewtopic.php?f=21&t=10122

Wireless Pico Micropython REPL
viewtopic.php?f=21&t=10109

Post Reply