kentindell / canhack

The Yes We CAN project of Canis Labs
MIT License
350 stars 65 forks source link

Will no longer compile for Micropython #21

Open ilium007 opened 1 year ago

ilium007 commented 1 year ago

I know this probably isn't the right place to ask but I would like to do some prototyping in Micropython using an RP2040 / MCP251863 on a custom PCB I am designing (to control over 70 clock faces using stepper motor boards). I have no need for the canhack code and wondered if I can modify to remove all the canhack stuff.

kentindell commented 1 year ago

Yes, there's a build option to cmake choose what to include. Have a dig through the cmake file.

ilium007 commented 1 year ago

Great! I'll check it out!

ilium007 commented 1 year ago

I have spent a few hours here this morning trying to compile on MacOS... Micropython v1.18 blows up on mpy-cross make:

CC ../py/objgenerator.c
../py/objgenerator.c:102:21: error: variable 'n_exc_stack_unused' set but not used [-Werror,-Wunused-but-set-variable]
    size_t n_state, n_exc_stack_unused, scope_flags, n_pos_args, n_kwonly_args, n_def_args;
                    ^
../py/objgenerator.c:102:41: error: variable 'scope_flags' set but not used [-Werror,-Wunused-but-set-variable]
    size_t n_state, n_exc_stack_unused, scope_flags, n_pos_args, n_kwonly_args, n_def_args;
                                        ^
../py/objgenerator.c:102:54: error: variable 'n_pos_args' set but not used [-Werror,-Wunused-but-set-variable]
    size_t n_state, n_exc_stack_unused, scope_flags, n_pos_args, n_kwonly_args, n_def_args;
                                                     ^
../py/objgenerator.c:102:66: error: variable 'n_kwonly_args' set but not used [-Werror,-Wunused-but-set-variable]
    size_t n_state, n_exc_stack_unused, scope_flags, n_pos_args, n_kwonly_args, n_def_args;
                                                                 ^
../py/objgenerator.c:102:81: error: variable 'n_def_args' set but not used [-Werror,-Wunused-but-set-variable]
    size_t n_state, n_exc_stack_unused, scope_flags, n_pos_args, n_kwonly_args, n_def_args;
                                                                                ^
5 errors generated.
make: *** [build/py/objgenerator.o] Error 1

and Micropython v1.20.0 fails after fixing the gchelper_m0.s, ,cpxxfd in CMakeLists.txt:

[  3%] Generating genhdr/qstr.i.last
In file included from /Users/xxxx/Documents/Projects/micropython/py/mphal.h:35,
                 from /Users/xxxx/Documents/Projects/micropython/extmod/machine_bitstream.c:29:
/Users/xxxx/Documents/Projects/micropython/ports/rp2/mphalport.h:33:10: fatal error: RP2040.h: No such file or directory
   33 | #include "RP2040.h" // cmsis, for __WFI
      |          ^~~~~~~~~~

And I've exhausted my capabilities!

ilium007 commented 1 year ago

I'll build a linux VM and try there.

ilium007 commented 1 year ago

Micropython v1.18 didn't compile on Debain 12 either:

 82%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/rp2_common/hardware_pll/pll.c.obj
[ 83%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/rp2_common/hardware_vreg/vreg.c.obj
[ 83%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/rp2_common/hardware_watchdog/watchdog.c.obj
[ 83%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/rp2_common/hardware_xosc/xosc.c.obj
[ 84%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/rp2_common/hardware_dma/dma.c.obj
[ 84%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/rp2_common/hardware_flash/flash.c.obj
In file included from /root/micropython/lib/pico-sdk/src/rp2_common/hardware_flash/flash.c:8:
In function 'rom_func_lookup_inline',
    inlined from 'flash_range_erase' at /root/micropython/lib/pico-sdk/src/rp2_common/hardware_flash/flash.c:69:91:
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:129:66: note: in expansion of macro 'rom_hword_as_ptr'
  129 |     rom_table_lookup_fn rom_table_lookup = (rom_table_lookup_fn) rom_hword_as_ptr(0x18);
      |                                                                  ^~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:130:41: note: in expansion of macro 'rom_hword_as_ptr'
  130 |     uint16_t *func_table = (uint16_t *) rom_hword_as_ptr(0x14);
      |                                         ^~~~~~~~~~~~~~~~
In function 'rom_func_lookup_inline',
    inlined from 'flash_range_erase' at /root/micropython/lib/pico-sdk/src/rp2_common/hardware_flash/flash.c:70:67:
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:129:66: note: in expansion of macro 'rom_hword_as_ptr'
  129 |     rom_table_lookup_fn rom_table_lookup = (rom_table_lookup_fn) rom_hword_as_ptr(0x18);
      |                                                                  ^~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:130:41: note: in expansion of macro 'rom_hword_as_ptr'
  130 |     uint16_t *func_table = (uint16_t *) rom_hword_as_ptr(0x14);
      |                                         ^~~~~~~~~~~~~~~~
In function 'rom_func_lookup_inline',
    inlined from 'flash_range_erase' at /root/micropython/lib/pico-sdk/src/rp2_common/hardware_flash/flash.c:71:76:
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
ilium007 commented 1 year ago

This could be related to the version of gcc:

gcc --version
gcc (Debian 12.2.0-14) 12.2.0
ilium007 commented 1 year ago

I can't even build the stock Micropython firmware (step 4 in this repo's build instructions):

root@arm-build01:~/micropython/ports/rp2# make
[  0%] Building C object CMakeFiles/micropy_extmod_btree.dir/root/micropython/lib/berkeley-db-1.xx/btree/bt_close.c.obj
[  1%] Building C object CMakeFiles/micropy_extmod_btree.dir/root/micropython/lib/berkeley-db-1.xx/btree/bt_conv.c.obj
[  1%] Building C object CMakeFiles/micropy_extmod_btree.dir/root/micropython/lib/berkeley-db-1.xx/btree/bt_debug.c.obj
[  1%] Building C object CMakeFiles/micropy_extmod_btree.dir/root/micropython/lib/berkeley-db-1.xx/btree/bt_delete.c.obj
[  2%] Building C object CMakeFiles/micropy_extmod_btree.dir/root/micropython/lib/berkeley-db-1.xx/btree/bt_get.c.obj
[  2%] Building C object CMakeFiles/micropy_extmod_btree.dir/root/micropython/lib/berkeley-db-1.xx/btree/bt_open.c.obj
[  2%] Building C object CMakeFiles/micropy_extmod_btree.dir/root/micropython/lib/berkeley-db-1.xx/btree/bt_overflow.c.obj
[  3%] Building C object CMakeFiles/micropy_extmod_btree.dir/root/micropython/lib/berkeley-db-1.xx/btree/bt_page.c.obj
[  3%] Building C object CMakeFiles/micropy_extmod_btree.dir/root/micropython/lib/berkeley-db-1.xx/btree/bt_put.c.obj
[  3%] Building C object CMakeFiles/micropy_extmod_btree.dir/root/micropython/lib/berkeley-db-1.xx/btree/bt_search.c.obj
[  4%] Building C object CMakeFiles/micropy_extmod_btree.dir/root/micropython/lib/berkeley-db-1.xx/btree/bt_seq.c.obj
[  4%] Building C object CMakeFiles/micropy_extmod_btree.dir/root/micropython/lib/berkeley-db-1.xx/btree/bt_split.c.obj
[  4%] Building C object CMakeFiles/micropy_extmod_btree.dir/root/micropython/lib/berkeley-db-1.xx/btree/bt_utils.c.obj
[  5%] Building C object CMakeFiles/micropy_extmod_btree.dir/root/micropython/lib/berkeley-db-1.xx/mpool/mpool.c.obj
[  5%] Built target micropy_extmod_btree
[  5%] Building ASM object pico-sdk/src/rp2_common/boot_stage2/CMakeFiles/bs2_default.dir/compile_time_choice.S.obj
[  6%] Linking ASM executable bs2_default.elf
[  6%] Built target bs2_default
[  7%] Generating bs2_default.bin
[  7%] Generating bs2_default_padded_checksummed.S
[  7%] Built target bs2_default_padded_checksummed_asm
[  7%] Creating directories for 'ELF2UF2Build'
[  8%] No download step for 'ELF2UF2Build'
[  8%] No update step for 'ELF2UF2Build'
[  9%] No patch step for 'ELF2UF2Build'
[  9%] Performing configure step for 'ELF2UF2Build'
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /root/micropython/ports/rp2/elf2uf2
[  9%] Performing build step for 'ELF2UF2Build'
[ 50%] Building CXX object CMakeFiles/elf2uf2.dir/main.cpp.o
[100%] Linking CXX executable elf2uf2
[100%] Built target elf2uf2
[  9%] No install step for 'ELF2UF2Build'
[  9%] Completed 'ELF2UF2Build'
[  9%] Built target ELF2UF2Build
[  9%] Generating genhdr/mpversion.h
GEN /root/micropython/ports/rp2/genhdr/mpversion.h
[ 10%] Generating genhdr/moduledefs.h
[ 10%] Generating genhdr/qstr.i.last
[ 10%] Generating genhdr/qstr.split
[ 11%] Generating genhdr/qstrdefs.collected.h
QSTR updated
[ 11%] Generating genhdr/qstrdefs.preprocessed.h
[ 11%] Generating genhdr/qstrdefs.generated.h
[ 12%] Generating frozen_content.c
MPY rp2.py
MPY _boot.py
MPY ds18x20.py
MPY onewire.py
MPY dht.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
MPY neopixel.py
GEN /root/micropython/ports/rp2/frozen_content.c
[ 12%] Building C object CMakeFiles/firmware.dir/root/micropython/py/argcheck.c.obj
[ 12%] Building C object CMakeFiles/firmware.dir/root/micropython/py/asmarm.c.obj
[ 13%] Building C object CMakeFiles/firmware.dir/root/micropython/py/asmbase.c.obj
[ 13%] Building C object CMakeFiles/firmware.dir/root/micropython/py/asmthumb.c.obj
[ 13%] Building C object CMakeFiles/firmware.dir/root/micropython/py/asmx64.c.obj
[ 13%] Building C object CMakeFiles/firmware.dir/root/micropython/py/asmx86.c.obj
[ 14%] Building C object CMakeFiles/firmware.dir/root/micropython/py/asmxtensa.c.obj
[ 14%] Building C object CMakeFiles/firmware.dir/root/micropython/py/bc.c.obj
[ 14%] Building C object CMakeFiles/firmware.dir/root/micropython/py/binary.c.obj
[ 15%] Building C object CMakeFiles/firmware.dir/root/micropython/py/builtinevex.c.obj
[ 15%] Building C object CMakeFiles/firmware.dir/root/micropython/py/builtinhelp.c.obj
[ 15%] Building C object CMakeFiles/firmware.dir/root/micropython/py/builtinimport.c.obj
[ 16%] Building C object CMakeFiles/firmware.dir/root/micropython/py/compile.c.obj
[ 16%] Building C object CMakeFiles/firmware.dir/root/micropython/py/emitbc.c.obj
[ 16%] Building C object CMakeFiles/firmware.dir/root/micropython/py/emitcommon.c.obj
[ 17%] Building C object CMakeFiles/firmware.dir/root/micropython/py/emitglue.c.obj
[ 17%] Building C object CMakeFiles/firmware.dir/root/micropython/py/emitinlinethumb.c.obj
[ 17%] Building C object CMakeFiles/firmware.dir/root/micropython/py/emitinlinextensa.c.obj
[ 18%] Building C object CMakeFiles/firmware.dir/root/micropython/py/emitnarm.c.obj
[ 18%] Building C object CMakeFiles/firmware.dir/root/micropython/py/emitnthumb.c.obj
[ 18%] Building C object CMakeFiles/firmware.dir/root/micropython/py/emitnx64.c.obj
[ 19%] Building C object CMakeFiles/firmware.dir/root/micropython/py/emitnx86.c.obj
[ 19%] Building C object CMakeFiles/firmware.dir/root/micropython/py/emitnxtensa.c.obj
[ 19%] Building C object CMakeFiles/firmware.dir/root/micropython/py/emitnxtensawin.c.obj
[ 20%] Building C object CMakeFiles/firmware.dir/root/micropython/py/formatfloat.c.obj
[ 20%] Building C object CMakeFiles/firmware.dir/root/micropython/py/frozenmod.c.obj
[ 20%] Building C object CMakeFiles/firmware.dir/root/micropython/py/gc.c.obj
[ 21%] Building C object CMakeFiles/firmware.dir/root/micropython/py/lexer.c.obj
[ 21%] Building C object CMakeFiles/firmware.dir/root/micropython/py/malloc.c.obj
[ 21%] Building C object CMakeFiles/firmware.dir/root/micropython/py/map.c.obj
[ 21%] Building C object CMakeFiles/firmware.dir/root/micropython/py/modarray.c.obj
[ 22%] Building C object CMakeFiles/firmware.dir/root/micropython/py/modbuiltins.c.obj
[ 22%] Building C object CMakeFiles/firmware.dir/root/micropython/py/modcmath.c.obj
[ 22%] Building C object CMakeFiles/firmware.dir/root/micropython/py/modcollections.c.obj
[ 23%] Building C object CMakeFiles/firmware.dir/root/micropython/py/modgc.c.obj
[ 23%] Building C object CMakeFiles/firmware.dir/root/micropython/py/modio.c.obj
[ 23%] Building C object CMakeFiles/firmware.dir/root/micropython/py/modmath.c.obj
[ 24%] Building C object CMakeFiles/firmware.dir/root/micropython/py/modmicropython.c.obj
[ 24%] Building C object CMakeFiles/firmware.dir/root/micropython/py/modstruct.c.obj
[ 24%] Building C object CMakeFiles/firmware.dir/root/micropython/py/modsys.c.obj
[ 25%] Building C object CMakeFiles/firmware.dir/root/micropython/py/modthread.c.obj
[ 25%] Building C object CMakeFiles/firmware.dir/root/micropython/py/moduerrno.c.obj
[ 25%] Building C object CMakeFiles/firmware.dir/root/micropython/py/mpprint.c.obj
[ 26%] Building C object CMakeFiles/firmware.dir/root/micropython/py/mpstate.c.obj
[ 26%] Building C object CMakeFiles/firmware.dir/root/micropython/py/mpz.c.obj
[ 26%] Building C object CMakeFiles/firmware.dir/root/micropython/py/nativeglue.c.obj
[ 27%] Building C object CMakeFiles/firmware.dir/root/micropython/py/nlr.c.obj
[ 27%] Building C object CMakeFiles/firmware.dir/root/micropython/py/nlrpowerpc.c.obj
[ 27%] Building C object CMakeFiles/firmware.dir/root/micropython/py/nlrsetjmp.c.obj
[ 28%] Building C object CMakeFiles/firmware.dir/root/micropython/py/nlrthumb.c.obj
[ 28%] Building C object CMakeFiles/firmware.dir/root/micropython/py/nlrx64.c.obj
[ 28%] Building C object CMakeFiles/firmware.dir/root/micropython/py/nlrx86.c.obj
[ 29%] Building C object CMakeFiles/firmware.dir/root/micropython/py/nlrxtensa.c.obj
[ 29%] Building C object CMakeFiles/firmware.dir/root/micropython/py/obj.c.obj
[ 29%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objarray.c.obj
[ 30%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objattrtuple.c.obj
[ 30%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objbool.c.obj
[ 30%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objboundmeth.c.obj
[ 30%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objcell.c.obj
[ 31%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objclosure.c.obj
[ 31%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objcomplex.c.obj
[ 31%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objdeque.c.obj
[ 32%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objdict.c.obj
[ 32%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objenumerate.c.obj
[ 32%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objexcept.c.obj
[ 33%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objfilter.c.obj
[ 33%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objfloat.c.obj
[ 33%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objfun.c.obj
[ 34%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objgenerator.c.obj
[ 34%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objgetitemiter.c.obj
[ 34%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objint.c.obj
[ 35%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objint_longlong.c.obj
[ 35%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objint_mpz.c.obj
[ 35%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objlist.c.obj
[ 36%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objmap.c.obj
[ 36%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objmodule.c.obj
[ 36%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objnamedtuple.c.obj
[ 37%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objnone.c.obj
[ 37%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objobject.c.obj
[ 37%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objpolyiter.c.obj
[ 38%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objproperty.c.obj
[ 38%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objrange.c.obj
[ 38%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objreversed.c.obj
[ 38%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objset.c.obj
[ 39%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objsingleton.c.obj
[ 39%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objslice.c.obj
[ 39%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objstr.c.obj
[ 40%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objstringio.c.obj
[ 40%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objstrunicode.c.obj
[ 40%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objtuple.c.obj
[ 41%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objtype.c.obj
[ 41%] Building C object CMakeFiles/firmware.dir/root/micropython/py/objzip.c.obj
[ 41%] Building C object CMakeFiles/firmware.dir/root/micropython/py/opmethods.c.obj
[ 42%] Building C object CMakeFiles/firmware.dir/root/micropython/py/pairheap.c.obj
[ 42%] Building C object CMakeFiles/firmware.dir/root/micropython/py/parse.c.obj
[ 42%] Building C object CMakeFiles/firmware.dir/root/micropython/py/parsenum.c.obj
[ 43%] Building C object CMakeFiles/firmware.dir/root/micropython/py/parsenumbase.c.obj
[ 43%] Building C object CMakeFiles/firmware.dir/root/micropython/py/persistentcode.c.obj
[ 43%] Building C object CMakeFiles/firmware.dir/root/micropython/py/profile.c.obj
[ 44%] Building C object CMakeFiles/firmware.dir/root/micropython/py/pystack.c.obj
[ 44%] Building C object CMakeFiles/firmware.dir/root/micropython/py/qstr.c.obj
[ 44%] Building C object CMakeFiles/firmware.dir/root/micropython/py/reader.c.obj
[ 45%] Building C object CMakeFiles/firmware.dir/root/micropython/py/repl.c.obj
[ 45%] Building C object CMakeFiles/firmware.dir/root/micropython/py/ringbuf.c.obj
[ 45%] Building C object CMakeFiles/firmware.dir/root/micropython/py/runtime.c.obj
[ 46%] Building C object CMakeFiles/firmware.dir/root/micropython/py/runtime_utils.c.obj
[ 46%] Building C object CMakeFiles/firmware.dir/root/micropython/py/scheduler.c.obj
[ 46%] Building C object CMakeFiles/firmware.dir/root/micropython/py/scope.c.obj
[ 46%] Building C object CMakeFiles/firmware.dir/root/micropython/py/sequence.c.obj
[ 47%] Building C object CMakeFiles/firmware.dir/root/micropython/py/showbc.c.obj
[ 47%] Building C object CMakeFiles/firmware.dir/root/micropython/py/smallint.c.obj
[ 47%] Building C object CMakeFiles/firmware.dir/root/micropython/py/stackctrl.c.obj
[ 48%] Building C object CMakeFiles/firmware.dir/root/micropython/py/stream.c.obj
[ 48%] Building C object CMakeFiles/firmware.dir/root/micropython/py/unicode.c.obj
[ 48%] Building C object CMakeFiles/firmware.dir/root/micropython/py/vm.c.obj
[ 49%] Building C object CMakeFiles/firmware.dir/root/micropython/py/vstr.c.obj
[ 49%] Building C object CMakeFiles/firmware.dir/root/micropython/py/warning.c.obj
[ 49%] Building C object CMakeFiles/firmware.dir/root/micropython/shared/libc/abort_.c.obj
[ 50%] Building C object CMakeFiles/firmware.dir/root/micropython/shared/libc/printf.c.obj
[ 50%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/machine_bitstream.c.obj
[ 50%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/machine_i2c.c.obj
[ 51%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/machine_mem.c.obj
[ 51%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/machine_pulse.c.obj
[ 51%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/machine_pwm.c.obj
[ 52%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/machine_signal.c.obj
[ 52%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/machine_spi.c.obj
[ 52%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/modbluetooth.c.obj
[ 53%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/modbtree.c.obj
[ 53%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/modframebuf.c.obj
[ 53%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/modnetwork.c.obj
[ 54%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/modonewire.c.obj
[ 54%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/moduasyncio.c.obj
[ 54%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/modubinascii.c.obj
[ 55%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/moducryptolib.c.obj
[ 55%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/moductypes.c.obj
[ 55%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/moduhashlib.c.obj
[ 55%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/moduheapq.c.obj
[ 56%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/modujson.c.obj
[ 56%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/moduplatform.c.obj
[ 56%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/modurandom.c.obj
[ 57%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/modure.c.obj
[ 57%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/moduselect.c.obj
[ 57%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/modusocket.c.obj
[ 58%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/modussl_axtls.c.obj
[ 58%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/modussl_mbedtls.c.obj
[ 58%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/modutimeq.c.obj
[ 59%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/moduwebsocket.c.obj
[ 59%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/moduzlib.c.obj
[ 59%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/modwebrepl.c.obj
[ 60%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/uos_dupterm.c.obj
[ 60%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/utime_mphal.c.obj
[ 60%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/vfs.c.obj
[ 61%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/vfs_blockdev.c.obj
[ 61%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/vfs_fat.c.obj
[ 61%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/vfs_fat_diskio.c.obj
[ 62%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/vfs_fat_file.c.obj
[ 62%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/vfs_lfs.c.obj
[ 62%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/vfs_posix.c.obj
[ 63%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/vfs_posix_file.c.obj
[ 63%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/vfs_reader.c.obj
[ 63%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/virtpin.c.obj
[ 63%] Building C object CMakeFiles/firmware.dir/root/micropython/extmod/nimble/modbluetooth_nimble.c.obj
[ 64%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/littlefs/lfs1.c.obj
[ 64%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/littlefs/lfs1_util.c.obj
[ 64%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/littlefs/lfs2.c.obj
[ 65%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/littlefs/lfs2_util.c.obj
[ 65%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/oofatfs/ff.c.obj
[ 65%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/oofatfs/ffunicode.c.obj
[ 66%] Building C object CMakeFiles/firmware.dir/root/micropython/shared/netutils/netutils.c.obj
[ 66%] Building C object CMakeFiles/firmware.dir/root/micropython/shared/readline/readline.c.obj
[ 66%] Building ASM object CMakeFiles/firmware.dir/root/micropython/shared/runtime/gchelper_m0.s.obj
[ 67%] Building C object CMakeFiles/firmware.dir/root/micropython/shared/runtime/gchelper_native.c.obj
[ 67%] Building C object CMakeFiles/firmware.dir/root/micropython/shared/runtime/mpirq.c.obj
[ 67%] Building C object CMakeFiles/firmware.dir/root/micropython/shared/runtime/pyexec.c.obj
[ 68%] Building C object CMakeFiles/firmware.dir/root/micropython/shared/runtime/stdout_helpers.c.obj
[ 68%] Building C object CMakeFiles/firmware.dir/root/micropython/shared/runtime/sys_stdio_mphal.c.obj
[ 68%] Building C object CMakeFiles/firmware.dir/root/micropython/shared/timeutils/timeutils.c.obj
[ 69%] Building C object CMakeFiles/firmware.dir/root/micropython/drivers/bus/softspi.c.obj
[ 69%] Building C object CMakeFiles/firmware.dir/root/micropython/drivers/dht/dht.c.obj
[ 69%] Building C object CMakeFiles/firmware.dir/fatfs_port.c.obj
[ 70%] Building C object CMakeFiles/firmware.dir/machine_adc.c.obj
[ 70%] Building C object CMakeFiles/firmware.dir/machine_bitstream.c.obj
[ 70%] Building C object CMakeFiles/firmware.dir/machine_i2c.c.obj
[ 71%] Building C object CMakeFiles/firmware.dir/machine_i2s.c.obj
[ 71%] Building C object CMakeFiles/firmware.dir/machine_pin.c.obj
[ 71%] Building C object CMakeFiles/firmware.dir/machine_rtc.c.obj
[ 71%] Building C object CMakeFiles/firmware.dir/machine_spi.c.obj
[ 72%] Building C object CMakeFiles/firmware.dir/machine_timer.c.obj
[ 72%] Building C object CMakeFiles/firmware.dir/machine_uart.c.obj
[ 72%] Building C object CMakeFiles/firmware.dir/machine_wdt.c.obj
[ 73%] Building C object CMakeFiles/firmware.dir/main.c.obj
[ 73%] Building C object CMakeFiles/firmware.dir/modmachine.c.obj
[ 73%] Building C object CMakeFiles/firmware.dir/modrp2.c.obj
[ 74%] Building C object CMakeFiles/firmware.dir/moduos.c.obj
[ 74%] Building C object CMakeFiles/firmware.dir/modutime.c.obj
[ 74%] Building C object CMakeFiles/firmware.dir/mphalport.c.obj
[ 75%] Building C object CMakeFiles/firmware.dir/mpthreadport.c.obj
[ 75%] Building C object CMakeFiles/firmware.dir/rp2_flash.c.obj
[ 75%] Building C object CMakeFiles/firmware.dir/rp2_pio.c.obj
[ 76%] Building C object CMakeFiles/firmware.dir/tusb_port.c.obj
[ 76%] Building C object CMakeFiles/firmware.dir/uart.c.obj
[ 76%] Generating genhdr/mpversion.h
[ 76%] Generating frozen_content.c
[ 76%] Building C object CMakeFiles/firmware.dir/frozen_content.c.obj
[ 77%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/rp2_common/hardware_adc/adc.c.obj
[ 77%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/rp2_common/hardware_claim/claim.c.obj
[ 77%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/rp2_common/pico_platform/platform.c.obj
[ 78%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/rp2_common/hardware_sync/sync.c.obj
[ 78%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/rp2_common/hardware_clocks/clocks.c.obj
[ 78%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/rp2_common/hardware_gpio/gpio.c.obj
[ 79%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/rp2_common/hardware_irq/irq.c.obj
[ 79%] Building ASM object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/rp2_common/hardware_irq/irq_handler_chain.S.obj
[ 79%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/common/pico_sync/sem.c.obj
[ 80%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/common/pico_sync/lock_core.c.obj
[ 80%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/common/pico_time/time.c.obj
[ 80%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/common/pico_time/timeout_helper.c.obj
[ 80%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/rp2_common/hardware_timer/timer.c.obj
[ 81%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/common/pico_util/datetime.c.obj
[ 81%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/common/pico_util/pheap.c.obj
[ 81%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/common/pico_util/queue.c.obj
[ 82%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/common/pico_sync/mutex.c.obj
[ 82%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/common/pico_sync/critical_section.c.obj
[ 82%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/rp2_common/hardware_pll/pll.c.obj
[ 83%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/rp2_common/hardware_vreg/vreg.c.obj
[ 83%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/rp2_common/hardware_watchdog/watchdog.c.obj
[ 83%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/rp2_common/hardware_xosc/xosc.c.obj
[ 84%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/rp2_common/hardware_dma/dma.c.obj
[ 84%] Building C object CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/rp2_common/hardware_flash/flash.c.obj
In file included from /root/micropython/lib/pico-sdk/src/rp2_common/hardware_flash/flash.c:8:
In function 'rom_func_lookup_inline',
    inlined from 'flash_range_erase' at /root/micropython/lib/pico-sdk/src/rp2_common/hardware_flash/flash.c:69:91:
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:129:66: note: in expansion of macro 'rom_hword_as_ptr'
  129 |     rom_table_lookup_fn rom_table_lookup = (rom_table_lookup_fn) rom_hword_as_ptr(0x18);
      |                                                                  ^~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:130:41: note: in expansion of macro 'rom_hword_as_ptr'
  130 |     uint16_t *func_table = (uint16_t *) rom_hword_as_ptr(0x14);
      |                                         ^~~~~~~~~~~~~~~~
In function 'rom_func_lookup_inline',
    inlined from 'flash_range_erase' at /root/micropython/lib/pico-sdk/src/rp2_common/hardware_flash/flash.c:70:67:
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:129:66: note: in expansion of macro 'rom_hword_as_ptr'
  129 |     rom_table_lookup_fn rom_table_lookup = (rom_table_lookup_fn) rom_hword_as_ptr(0x18);
      |                                                                  ^~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:130:41: note: in expansion of macro 'rom_hword_as_ptr'
  130 |     uint16_t *func_table = (uint16_t *) rom_hword_as_ptr(0x14);
      |                                         ^~~~~~~~~~~~~~~~
In function 'rom_func_lookup_inline',
    inlined from 'flash_range_erase' at /root/micropython/lib/pico-sdk/src/rp2_common/hardware_flash/flash.c:71:76:
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:129:66: note: in expansion of macro 'rom_hword_as_ptr'
  129 |     rom_table_lookup_fn rom_table_lookup = (rom_table_lookup_fn) rom_hword_as_ptr(0x18);
      |                                                                  ^~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:130:41: note: in expansion of macro 'rom_hword_as_ptr'
  130 |     uint16_t *func_table = (uint16_t *) rom_hword_as_ptr(0x14);
      |                                         ^~~~~~~~~~~~~~~~
In function 'rom_func_lookup_inline',
    inlined from 'flash_range_erase' at /root/micropython/lib/pico-sdk/src/rp2_common/hardware_flash/flash.c:72:76:
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:129:66: note: in expansion of macro 'rom_hword_as_ptr'
  129 |     rom_table_lookup_fn rom_table_lookup = (rom_table_lookup_fn) rom_hword_as_ptr(0x18);
      |                                                                  ^~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:130:41: note: in expansion of macro 'rom_hword_as_ptr'
  130 |     uint16_t *func_table = (uint16_t *) rom_hword_as_ptr(0x14);
      |                                         ^~~~~~~~~~~~~~~~
In function 'rom_func_lookup_inline',
    inlined from 'flash_range_program' at /root/micropython/lib/pico-sdk/src/rp2_common/hardware_flash/flash.c:92:91:
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:129:66: note: in expansion of macro 'rom_hword_as_ptr'
  129 |     rom_table_lookup_fn rom_table_lookup = (rom_table_lookup_fn) rom_hword_as_ptr(0x18);
      |                                                                  ^~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:130:41: note: in expansion of macro 'rom_hword_as_ptr'
  130 |     uint16_t *func_table = (uint16_t *) rom_hword_as_ptr(0x14);
      |                                         ^~~~~~~~~~~~~~~~
In function 'rom_func_lookup_inline',
    inlined from 'flash_range_program' at /root/micropython/lib/pico-sdk/src/rp2_common/hardware_flash/flash.c:93:67:
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:129:66: note: in expansion of macro 'rom_hword_as_ptr'
  129 |     rom_table_lookup_fn rom_table_lookup = (rom_table_lookup_fn) rom_hword_as_ptr(0x18);
      |                                                                  ^~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:130:41: note: in expansion of macro 'rom_hword_as_ptr'
  130 |     uint16_t *func_table = (uint16_t *) rom_hword_as_ptr(0x14);
      |                                         ^~~~~~~~~~~~~~~~
In function 'rom_func_lookup_inline',
    inlined from 'flash_range_program' at /root/micropython/lib/pico-sdk/src/rp2_common/hardware_flash/flash.c:94:82:
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:129:66: note: in expansion of macro 'rom_hword_as_ptr'
  129 |     rom_table_lookup_fn rom_table_lookup = (rom_table_lookup_fn) rom_hword_as_ptr(0x18);
      |                                                                  ^~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:130:41: note: in expansion of macro 'rom_hword_as_ptr'
  130 |     uint16_t *func_table = (uint16_t *) rom_hword_as_ptr(0x14);
      |                                         ^~~~~~~~~~~~~~~~
In function 'rom_func_lookup_inline',
    inlined from 'flash_range_program' at /root/micropython/lib/pico-sdk/src/rp2_common/hardware_flash/flash.c:95:76:
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:129:66: note: in expansion of macro 'rom_hword_as_ptr'
  129 |     rom_table_lookup_fn rom_table_lookup = (rom_table_lookup_fn) rom_hword_as_ptr(0x18);
      |                                                                  ^~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:130:41: note: in expansion of macro 'rom_hword_as_ptr'
  130 |     uint16_t *func_table = (uint16_t *) rom_hword_as_ptr(0x14);
      |                                         ^~~~~~~~~~~~~~~~
In function 'rom_func_lookup_inline',
    inlined from 'flash_do_cmd' at /root/micropython/lib/pico-sdk/src/rp2_common/hardware_flash/flash.c:125:91:
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:129:66: note: in expansion of macro 'rom_hword_as_ptr'
  129 |     rom_table_lookup_fn rom_table_lookup = (rom_table_lookup_fn) rom_hword_as_ptr(0x18);
      |                                                                  ^~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:130:41: note: in expansion of macro 'rom_hword_as_ptr'
  130 |     uint16_t *func_table = (uint16_t *) rom_hword_as_ptr(0x14);
      |                                         ^~~~~~~~~~~~~~~~
In function 'rom_func_lookup_inline',
    inlined from 'flash_do_cmd' at /root/micropython/lib/pico-sdk/src/rp2_common/hardware_flash/flash.c:126:67:
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:129:66: note: in expansion of macro 'rom_hword_as_ptr'
  129 |     rom_table_lookup_fn rom_table_lookup = (rom_table_lookup_fn) rom_hword_as_ptr(0x18);
      |                                                                  ^~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:130:41: note: in expansion of macro 'rom_hword_as_ptr'
  130 |     uint16_t *func_table = (uint16_t *) rom_hword_as_ptr(0x14);
      |                                         ^~~~~~~~~~~~~~~~
In function 'rom_func_lookup_inline',
    inlined from 'flash_do_cmd' at /root/micropython/lib/pico-sdk/src/rp2_common/hardware_flash/flash.c:127:76:
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:129:66: note: in expansion of macro 'rom_hword_as_ptr'
  129 |     rom_table_lookup_fn rom_table_lookup = (rom_table_lookup_fn) rom_hword_as_ptr(0x18);
      |                                                                  ^~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:120:59: error: array subscript 0 is outside array bounds of 'uint16_t[0]' {aka 'short unsigned int[]'} [-Werror=array-bounds]
  120 | #define rom_hword_as_ptr(rom_address) (void *)(uintptr_t)(*(uint16_t *)rom_address)
      |                                                          ~^~~~~~~~~~~~~~~~~~~~~~~~~
/root/micropython/lib/pico-sdk/src/rp2_common/pico_bootrom/include/pico/bootrom.h:130:41: note: in expansion of macro 'rom_hword_as_ptr'
  130 |     uint16_t *func_table = (uint16_t *) rom_hword_as_ptr(0x14);
      |                                         ^~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/firmware.dir/build.make:3627: CMakeFiles/firmware.dir/root/micropython/lib/pico-sdk/src/rp2_common/hardware_flash/flash.c.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:1357: CMakeFiles/firmware.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
root@arm-build01:~/micropython/ports/rp2#
kentindell commented 1 year ago

You have to get a recent Arm gcc, and you have to do that by downloading directly from Arm (they removed their repo from which you could install via a Debian package manager).

ilium007 commented 1 year ago

Yes... tried that!!

ilium007 commented 1 year ago

I built a new Debian 12 VM and performed steps below. I can now get all the way through to building the CANPico firmware but hit this same error (I can now build stock firmware on this machine):

In file included from /root/micropython/py/mphal.h:35,
                 from /root/micropython/extmod/modplatform.c:31:
/root/micropython/ports/rp2/mphalport.h:33:10: fatal error: RP2040.h: No such file or directory
   33 | #include "RP2040.h" // cmsis, for __WFI

RP2040.h is found here:

root@build01:~/micropython# find . -name RP2040.h
./lib/pico-sdk/src/rp2_common/cmsis/stub/CMSIS/Device/RaspberryPi/RP2040/Include/RP2040.h

Build steps from fresh Debian 12 - NOTE: there are some CMakeLists.txt changes because file names have changed somewhere along the way:

apt update && apt install vim git curl cmake build-essential libffi-dev git pkg-config

ARM_TOOLCHAIN_VERSION=$(curl -s https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads | grep -Po '<h4>Version \K.+(?=</h4>)')

curl -Lo gcc-arm-none-eabi.tar.xz "https://developer.arm.com/-/media/Files/downloads/gnu/${ARM_TOOLCHAIN_VERSION}/binrel/arm-gnu-toolchain-${ARM_TOOLCHAIN_VERSION}-x86_64-arm-none-eabi.tar.xz"

mkdir /opt/gcc-arm-none-eabi

tar xf gcc-arm-none-eabi.tar.xz --strip-components=1 -C /opt/gcc-arm-none-eabi

echo 'export PATH=$PATH:/opt/gcc-arm-none-eabi/bin' | tee -a /etc/profile.d/gcc-arm-none-eabi.sh

source /etc/profile

root@build01:~# arm-none-eabi-gcc --version
arm-none-eabi-gcc (Arm GNU Toolchain 12.3.Rel1 (Build arm-12.35)) 12.3.1 20230626
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

root@build01:~# arm-none-eabi-g++ --version
arm-none-eabi-g++ (Arm GNU Toolchain 12.3.Rel1 (Build arm-12.35)) 12.3.1 20230626
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

0. Get canhack source
-----------------------------
git clone https://github.com/kentindell/canhack.git

1. Get the MicroPython source
-----------------------------
git clone http://github.com/micropython/micropython.git

cd micropython

## Trying to build v1.20.0
# git checkout v1.18

git submodule update --init

2. Add MIN
----------
cd lib
git clone https://github.com/min-protocol/min.git
cd ..

3. Build mpy-cross
------------------
cd mpy-cross
make
cd ..

4. Check this has worked by making the stock Pico firmware
----------------------------------------------------------
cd ports/rp2/
cmake CMakeLists.txt
make -j CFLAGS=-Wno-array-bounds

6. Patch the firmware
---------------------
cd ~/canhack/pico/micropython
cp -R canis CMakeLists.txt machine_pin.c modrp2.c tusb_config.h tusb_port.c main.c mpconfigport.h ~/micropython/ports/rp2/

7. Add the Canis CAN SDK
------------------------
cd ~/micropython/ports/rp2/canis
git clone https://github.com/kentindell/canis-can-sdk candrivers
cd ..

8. Re-build the firmware
---------------------
rm -rf Makefile CMakeFiles CMakeCache.txt genhdr generated frozen_content.c pico-sdk pioasm frozen_content.c

sed -i 's/gchelper_m0.s/gchelper_thumb1.s/g' /root/micropython/ports/rp2/CMakeLists.txt
sed -i 's/mcp2517fd/mcp25xxfd/g' /root/micropython/ports/rp2/CMakeLists.txt
sed -i 's/moduos.c/modos.c/g' /root/micropython/ports/rp2/CMakeLists.txt
sed -i 's/modutime.c/modtime.c/g' /root/micropython/ports/rp2/CMakeLists.txt

cmake CMakeLists.txt -DCAN=1 -DCANPICO=1
make -j CFLAGS=-Wno-array-bounds
ilium007 commented 1 year ago

Aside from the compile issues I have, I'm still unsure how to compile without the canhack toolkit:

"The CANHack toolkit is a proof-of-concept toolkit of different CAN protocol attacks, showing the viability of low-level bit-banging attacks on the CAN protocol itself."

I would like to make use of the CAN library for sending canbus data without any need for the canhack code (I'm trying to use as little memory as possible) and I am trying to design a RP2040 based board using the MCP251863 with integrated CAN controller and transceiver to lower component count.

I had a look at the CMakeListys.txt as directed but I can't see how to remove the canhack code altogether.

The code below seems to include it by default when running: cmake CMakeLists.txt -DCAN=1 -DCANPICO=1

if(CAN OR CRYPTOCAN)
    list(APPEND MICROPY_SOURCE_PORT
        ${PROJECT_SOURCE_DIR}/canis/canhack.c
        ${PROJECT_SOURCE_DIR}/canis/rp2_canhack.c
        ${PROJECT_SOURCE_DIR}/canis/rp2_can.c
        ${CANDRIVERS_SOURCE_LIB}
    )
    list(APPEND MICROPY_SOURCE_QSTR
        ${PROJECT_SOURCE_DIR}/canis/rp2_canhack.c
        ${PROJECT_SOURCE_DIR}/canis/rp2_can.c
    )
endif()
ilium007 commented 1 year ago

Back on Micropython git v1.18 and still getting errors:

[ 68%] Building C object CMakeFiles/firmware.dir/fatfs_port.c.obj
[ 68%] Building C object CMakeFiles/firmware.dir/machine_adc.c.obj
[ 68%] Building C object CMakeFiles/firmware.dir/machine_bitstream.c.obj
[ 69%] Building C object CMakeFiles/firmware.dir/machine_i2c.c.obj
[ 69%] Building C object CMakeFiles/firmware.dir/machine_i2s.c.obj
[ 69%] Building C object CMakeFiles/firmware.dir/machine_pin.c.obj
In file included from /home/xx/micropython/ports/rp2/canis/candrivers/mcp25xxfd/mcp25xxfd-types.h:23,
                 from /home/xx/micropython/ports/rp2/canis/candrivers/canapi.h:40,
                 from /home/xx/micropython/ports/rp2/machine_pin.c:115:
/home/xx/micropython/ports/rp2/canis/candrivers/mcp25xxfd/rp2/mcp25xxfd-rp2.h: In function 'mcp25xxfd_spi_gpio_irq_asserted':
/home/xx/micropython/ports/rp2/canis/candrivers/mcp25xxfd/rp2/mcp25xxfd-rp2.h:123:9: warning: implicit declaration of function 'gpio_get_irq_event_mask' [-Wimplicit-function-declaration]
  123 |     if (gpio_get_irq_event_mask(interface->spi_irq) & GPIO_IRQ_LEVEL_LOW) {
      |         ^~~~~~~~~~~~~~~~~~~~~~~
/home/xx/micropython/ports/rp2/machine_pin.c: In function 'gpio_irq':
/home/xx/micropython/ports/rp2/machine_pin.c:144:9: error: too few arguments to function 'mcp25xxfd_irq_handler'
  144 |         mcp25xxfd_irq_handler();
      |         ^~~~~~~~~~~~~~~~~~~~~
/home/xx/micropython/ports/rp2/canis/candrivers/canapi.h:822:6: note: declared here
  822 | void mcp25xxfd_irq_handler(can_controller_t *controller);
      |      ^~~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/firmware.dir/build.make:3060: CMakeFiles/firmware.dir/machine_pin.c.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:1357: CMakeFiles/firmware.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
❯ vi /home/xx/micropython/ports/rp2/machine_pin.c
~/micropython/ports/rp2 #v1.18 !8 ?12 ❯
ilium007 commented 1 year ago

This was after changing /home/xx/micropython/ports/rp2/machine_pin.c (mcp2517fd_irq_handler has been changed to mcp25xxfd_irq_handler) due to the error below:

[ 69%] Building C object CMakeFiles/firmware.dir/machine_pin.c.obj
In file included from /home/xx/micropython/ports/rp2/canis/candrivers/mcp25xxfd/mcp25xxfd-types.h:23,
                 from /home/xx/micropython/ports/rp2/canis/candrivers/canapi.h:40,
                 from /home/xx/ports/rp2/canis/candrivers/mcp25xxfd/rp2/mcp25xxfd-rp2.h: In function 'mcp25xxfd_spi_gpio_irq_asserted':
/home/xx/micropython/ports/rp2/canis/candrivers/mcp25xxfd/rp2/mcp25xxfd-rp2.h:123:9: error: implicit declaration of function 'gpio_get_irq_event_mask' [-Werror=implicit-function-declaration]
  123 |     if (gpio_get_irq_event_mask(interface->spi_irq) & GPIO_IRQ_LEVEL_LOW) {
      |         ^~~~~~~~~~~~~~~~~~~~~~~
/home/xx/micropython/ports/rp2/machine_pin.c: In function 'gpio_irq':
/home/xx/micropython/ports/rp2/machine_pin.c:144:9: error: implicit declaration of function 'mcp2517fd_irq_handler'; did you mean 'mcp25xxfd_irq_handler'? [-Werror=implicit-function-declaration]
  144 |         mcp2517fd_irq_handler();
      |         ^~~~~~~~~~~~~~~~~~~~~
      |         mcp25xxfd_irq_handler
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/firmware.dir/build.make:3060: CMakeFiles/firmware.dir/machine_pin.c.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:1357: CMakeFiles/firmware.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
kentindell commented 1 year ago

I have a build for v1.20 of MicroPython (with Pico W WiFi support) and I'll push it out to here shortly (I'm hoping to roll the new CAN FD drivers in to it - they're written but need testing).

ilium007 commented 1 year ago

I am keen to know how you compiled it! I still can't get v1.18 to build!

kentindell commented 1 year ago

I found the git submodules to be awkward: it's trying to keep many things in sync, and the Pico C SDK has its own TinyUSB. And I found some irritating USB header problems as a result. Can you get v1.20 to build? It's a twisty maze of cmake files, but it should build (on Ubuntu for me).

ilium007 commented 1 year ago

Thanks for looking at it. No, I wasn't able to get v1.20 to build either.

ilium007 commented 1 year ago

No luck on building yet...

jack60612 commented 1 year ago

any updates on the latest version @kentindell ?

I got one to build with the master branch of micropython, but my c is a little bad so i would prefer an official version.