Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RP2] When building with external board definition directory, machine.Pin.board is not populated. #14342

Open
2 tasks done
ricksorensen opened this issue Apr 20, 2024 · 0 comments
Labels

Comments

@ricksorensen
Copy link
Contributor

ricksorensen commented Apr 20, 2024

Checks

  • I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.

  • I've searched for existing issues matching this bug, and didn't find any.

Port, board and/or hardware

RP2

MicroPython version

$ git describe --dirty
v1.22.0-325-gd11ca092f
$ mpremote
Connected to MicroPython at /dev/ttyACM0
Use Ctrl-] or Ctrl-x to exit this shell

>>> 
MPY: soft reboot
MicroPython v1.23.0-preview.324.gd11ca092f on 2024-04-20; XIAO RP2040 Local with RP2040
Type "help()" for more information.

Reproduction

I am using linux to build, with an external definition of board in :
/work/domicropy/rjsboards/SEEED_XIAO_RP2040 with contents:

$ ls /work/domicropy/rjsboards/SEEED_XIAO_RP2040/
board.json  mpconfigboard.cmake  mpconfigboard.h  pins.csv

comment: from ports/rp2, after prelims
$ make BOARD_DIR=/work/domicropy/rjsboards/SEEED_XIAO_RP2040/
$ mpremote bootloader 
# example for my linux:
$ cp build-SEEED_XIAO_RP2040/firmware.uf2  /media/rick/RPI-RP2
# reset board  
$ mpremote
>>> import machine
>>> dir(machine.Pin.board)

Expected behaviour

Expected list of pins described in pins.csv, which is stored in external board definition

>>>import machine
>>>dir(machine.Pin.board)
['__class__', '__name__', 'D0_A0', 'D1_A1', 'D2_A2', 'D3_A3', 'GP0', 'GP1', 'GP10', 'GP11', 'GP12', 'GP13', 'GP14', 'GP15', 'GP16', 'GP17', 'GP18', 'GP19', 'GP2', 'GP20', 'GP21', 'GP22', 'GP25', 'GP26', 'GP27', 'GP28', 'GP3', 'GP4', 'GP5', 'GP6', 'GP7', 'GP8', 'GP9', 'LED', 'XIAO_MISO', 'XIAO_MOSI', 'XIAO_RX', 'XIAO_SCK', 'XIAO_SCL', 'XIAO_SDA', 'XIAO_TX', '__bases__', '__dict__']
>>>

Observed behaviour

Observed behavior has no pins defined in machine.Pin.board:

>>>import machine
>>>dir(machine.Pin.board)
['__class__', '__name__',  '__bases__', '__dict__']
>>>

Additional Information

The problem appears to be in CMakeLists.txt with a probably incorrect conditional are around pins.csv usage. ... See esp32/CMakeLists.txt for a work around:

comment:  from the original clone, compare with my update:
$ diff -b -w CMakeLists.txt ../../../rjsfork/ports/rp2/CMakeLists.txt
540,541c540,541
< if(EXISTS "${MICROPY_BOARDS_DIR}/${MICROPY_BOARD}/pins.csv")
<     set(GEN_PINS_BOARD_CSV "${MICROPY_BOARDS_DIR}/${MICROPY_BOARD}/pins.csv")
---
> if(EXISTS "${MICROPY_BOARD_DIR}/pins.csv")
>     set(GEN_PINS_BOARD_CSV "${MICROPY_BOARD_DIR}/pins.csv")
$

I have historical difficulties creating and especially updating pull requests - sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant