[DEV] RP2040 support

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
steved
Posts: 825
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: [NOTES] Multi Core support

Postby steved » Wed Jan 27, 2021 9:40 pm

This commit suggests that:
a) You need the RPi version of openOCD to support multiple processors
b) Only bitbang and FTDI-style serial interfaces are supported at present. Is ST-Link fundamentally serial?

Clearly aimed at using a Raspberry Pi as the debug interface initially; possibly other platforms also work

On a quick look I couldn't see that RPi had pushed their changes back to the main OpenOCD repository; certainly the script files weren't there.

The Pi Foundation have a policy of not releasing information in advance of real product; then on launch day there's a whole lot of updates to documentation and so on all at once. OpenOCD probably isn't a high priority ATM; I'm sure the updates will be pushed in due course

User avatar
FXCoder
Posts: 384
Joined: Sun Jun 12, 2016 4:10 am
Location: Sydney, Australia
Has thanked: 180 times
Been thanked: 130 times

Re: [NOTES] Multi Core support

Postby FXCoder » Wed Jan 27, 2021 11:08 pm

Hi,
Don't see any RP2040 based submissions on the openocd gerrit site.
(Gerrit process is required before for getting to commit on openocd SF master).

Anyway early days yet for the pico so maybe asking Liam Fraser might reveal something?
--
Bob

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

[DEV] RP2040 Support

Postby Giovanni » Thu Jan 28, 2021 10:00 am

Hopefully they will send their OpenOCD changes upstream, it would be difficult to have to handle multiple OpenOCD implementations.

Giovanni

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: [NOTES] Multi Core support

Postby Giovanni » Thu Jan 28, 2021 6:39 pm

Hi,

I studied the DS a little bit and I must say that this device is interesting, I am impressed for a "first device" from a small company.

Everything seems to be fine for a ChibiOS port, the timer is perfect for tickless more and RT time (monotonic 64 bits counter and comparators). DMA seems to not have an "half buffer" interrupt so implementing the ADC driver could be a little complex because it would need to leverage channels linking probably.

Dual core support looks good but I have not yet found a way for a core to notify the other core through an interrupt, this is required if one core makes a thread belonging to the other core "ready", it needs to notify the other core that its ready list has been updated and a reschedule is required. Maybe this is possible using the FIFOs, I have to study this some more.

They did a lot of work on the SW side, the port should be done in a way that enhances the ecosystem in order to leverage it, for sure I don't want to be too "alternative" in this case.

Giovanni

Ludeks
Posts: 9
Joined: Sun Mar 13, 2016 2:52 pm
Has thanked: 3 times

Re: [NOTES] Multi Core support

Postby Ludeks » Fri Jan 29, 2021 12:11 am

That's great news to hear! :)

With regards to the multi core communication, the cores are interconnected through 2 FIFOs, writing to the FIFO from one core can raise an interrupt on the other core.

See section 2.3.1.4. Inter-processor FIFOs (Mailboxes)

...
Each FIFO is 32 bits wide, and eight entries deep. One of the FIFOs can only be written by core 0, and read by core 1. The other can only be written by core 1, and read by core 0.
...
The SIO has a FIFO IRQ output for each core, mapped to system IRQ numbers 15 and 16.
...
If the corresponding interrupt line is enabled in the Cortex-M0+ NVIC, then the processor will take an interrupt each time data appears in its FIFO, or if it has performed some invalid FIFO operation (read on empty, write on full). Typically Core 0 will use IRQ15 and core 1 will use IRQ16.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

[NOTES] Multi Core support

Postby Giovanni » Fri Jan 29, 2021 3:40 pm

Well, first problems:

1) No CMSIS files anywhere in the SDK, headers would have to be created. The SDK is entirely custom so hardly compatible with anything. Their IRQ system is custom (IRQ chains for shared interrupts) and it is not compatible with an RTOS which requires its code in handlers, this is an extra problem.

2) I tried to build the blinker demo following the "getting started" document and it failed, with an asm error:

Code: Select all

giovanni@Freya:~/Projects/pico/pico-examples/build/blink$ make
[  0%] Creating directories for 'ELF2UF2Build'
[  0%] No download step for 'ELF2UF2Build'
[  0%] No patch step for 'ELF2UF2Build'
[  0%] No update step for 'ELF2UF2Build'
[  0%] Performing configure step for 'ELF2UF2Build'
-- Configuring done
-- Generating done
-- Build files have been written to: /home/giovanni/Projects/pico/pico-examples/build/elf2uf2
[  0%] Performing build step for 'ELF2UF2Build'
[100%] Built target elf2uf2
[  0%] No install step for 'ELF2UF2Build'
[  0%] Completed 'ELF2UF2Build'
[  0%] Built target ELF2UF2Build
[  0%] Built target bs2_default
[  0%] Built target bs2_default_bin
[  0%] Built target bs2_default_padded_checksummed_asm
[  0%] Building C object blink/CMakeFiles/blink.dir/blink.c.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/pico_stdlib/stdlib.c.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_gpio/gpio.c.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_claim/claim.c.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_sync/sync.c.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/pico_platform/platform.c.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_uart/uart.c.obj
[  0%] Building ASM object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_divider/divider.S.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/common/pico_time/time.c.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/common/pico_time/timeout_helper.c.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_timer/timer.c.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/common/pico_sync/sem.c.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/common/pico_sync/lock_core.c.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/common/pico_sync/mutex.c.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/common/pico_sync/critical_section.c.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/common/pico_util/datetime.c.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/common/pico_util/pheap.c.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/common/pico_util/queue.c.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/pico_runtime/runtime.c.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_clocks/clocks.c.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_watchdog/watchdog.c.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_xosc/xosc.c.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_pll/pll.c.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_vreg/vreg.c.obj
[  0%] Building C object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_irq/irq.c.obj
[  0%] Building ASM object blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_irq/irq_handler_chain.S.obj
/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_irq/irq_handler_chain.S: Assembler messages:
/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_irq/irq_handler_chain.S:54: Error: bad instruction `u'
/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_irq/irq_handler_chain.S:54: Error: junk at end of line, first unrecognized character is `u'
/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_irq/irq_handler_chain.S:54: Error: bad instruction `u'
/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_irq/irq_handler_chain.S:54: Error: junk at end of line, first unrecognized character is `u'
/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_irq/irq_handler_chain.S:54: Error: bad instruction `u'
/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_irq/irq_handler_chain.S:54: Error: junk at end of line, first unrecognized character is `u'
/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_irq/irq_handler_chain.S:54: Error: bad instruction `u'
/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_irq/irq_handler_chain.S:54: Error: junk at end of line, first unrecognized character is `u'
make[2]: *** [blink/CMakeFiles/blink.dir/build.make:380: blink/CMakeFiles/blink.dir/home/giovanni/Projects/pico/pico-sdk/src/rp2_common/hardware_irq/irq_handler_chain.S.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:3493: blink/CMakeFiles/blink.dir/all] Error 2
make: *** [Makefile:84: all] Error 2


Not sure what is this about, the build system is very complex and I have not figured out what command has been executed and its options. It seems to assume you are using an RPI for development, probably it is not compatible with Mint/Ubuntu.

This thing will have to wait, too much time spent with no LED blinking yet.

Giovanni

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: [NOTES] Multi Core support

Postby Giovanni » Fri Jan 29, 2021 10:59 pm

At least the build problem is solved, I have GCC 5.4.1 as default, it needs a more recent version.

Giovanni

steved
Posts: 825
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: [NOTES] Multi Core support

Postby steved » Fri Jan 29, 2021 11:59 pm

Giovanni wrote:At least the build problem is solved, I have GCC 5.4.1 as default, it needs a more recent version.

Giovanni

They apparently tested with a range of compilers, but not that old!

Latest wisdom is that current ST-Link won't support multi-processor without ST upgrading it. JLink works. And you can also use another Pico (see Appendix A of "getting started").

steved
Posts: 825
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: [NOTES] Multi Core support

Postby steved » Sat Jan 30, 2021 10:53 am

This guy is doing bare-metal stuff on the Pico (and the Pi) - might be some useful pointers to getting things going. This thread covers the first attempts.

steved
Posts: 825
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: [NOTES] Multi Core support

Postby steved » Sat Jan 30, 2021 6:36 pm

Giovanni wrote:Well, first problems:

1) No CMSIS files anywhere in the SDK, headers would have to be created. The SDK is entirely custom so hardly compatible with anything. Their IRQ system is custom (IRQ chains for shared interrupts) and it is not compatible with an RTOS which requires its code in handlers, this is an extra problem.

All the header files for the chip are in pico-sdk-master\src\rp2040 - can they be used 'as is', at least until the next device in the family comes out?


Return to “Development and Feedback”

Who is online

Users browsing this forum: No registered users and 16 guests