• Exploring the Bootrom

    Uri Shaked3 days ago 0 comments

    Last week, we spent some time exploring the Pi Pico's bootrom and stage-2 bootloader. We explored __vector_entry, found some nice ASCII art buried deep in the Pico's SDK, and also implemented BL, LSRS and LDMIA:

    The next live-streamwill take place tomorrow, 7pm GMT (11am PST, 2pm EST, 8pm CET).

    If you wish, add it to your Google calendar.

  • Exploring the Bootrom

    Uri Shaked3 days ago 0 comments

    Last week, we spent some time exploring the Pi Pico's bootrom and stage-2 bootloader. We explored __vector_entry, found some nice ASCII art buried deep in the Pico's SDK, and also implemented BL, LSRS and LDMIA:

    The next live-stream will take place tomorrow, 7pm GMT (11am PST, 2pm EST, 8pm CET).

    If you wish, add it to your Google calendar.

  • UART working!!1

    Uri Shaked02/14/2021 at 23:07 0 comments

    This week's coding session ended with a glorious victory: UART works! 🎉

    You can watch the exciting moment at 1:43:15. 

    Or, you can watch all the work that led into it: implementing ADDS, SUBS, NEGS, LDRB, ADCS, and UXTB.

    We also spent some time tidying-up the code, came up with our own mini-assembler for the unit-tests, implemented memory write hooks and and split the code into smaller modules (e.g. UART).

    To conclude the party, we started looking at the Raspberry Pi Pico's bootrom which I'll try to run inside the emulator in the next episode. 🤞

    Episode replay:

  • Thank You

    Uri Shaked02/08/2021 at 21:54 0 comments

    Thanks to your support, our emulator made it to the week's most liked projects on Hackaday!

    Thanks ;-)

    p.s. I will be streaming the next episode tomorrow, the usual time. Watch here: https://youtu.be/GtM800DFPNo

  • Taming UART, Flags, and 7 new instructions!

    Uri Shaked02/07/2021 at 23:45 0 comments

    In the second episode of the RP2040 Emulator coding live-stream we had an ambitious goal: implement UART so we can see debug prints from the simulated program.

    We loaded the hello_uart example program, looked at the disassembly, and started implementing the instructions in a TDD (test-driven development) manner, similar to the first live-stream:

    • LDR (Load Register) - both literal and immediate variants
    • TST, which also means we had to implement the APSR (flags) register
    • BNE.N - in fact, we took care of all the conditional branches!
    • LDRSH
    • CMP - just as with LDR, we did both literal and immediate variants

    We also took care of implementing CPU Read Hooks, which allow peripherals to intercept memory reads from their mapped regions. This allowed us to mimic the behavior of the UARTFR, indicating to the simulated code that the UART hardware is ready to receive the next character.

    You can watch the complete episode here:

    And check out the project's code on GitHub: https://github.com/wokwi/rp2040js

    If you don't want to miss out the next episode, make sure to sign up and get a reminder when it goes live!

  • UF2 Library and a RP2040 Python Disassembler

    Uri Shaked02/01/2021 at 23:41 0 comments

    Preparing for the stream tomorrow, I created a small JavaScript library to read the UF2 file format. I'm still not sure if we'll use it or continue with the .hex files, but it was fun creating it nevertheless!

    The source code is available here: https://github.com/wokwi/uf2 (it has a nice unit-test suite),
    and it has also been published as an NPM package: https://www.npmjs.com/package/uf2.

    Meanwhile, some random programmer who watched the stream started working on a RP2040 disassembler in Python: https://github.com/pyTony/rp2040

    Nice work Tony! Thank you for sharing it with us :-)

  • Let there be Serial: Hacking UART

    Uri Shaked01/31/2021 at 23:49 0 comments

    Hacking the Pico simulator on a live stream was a bit intense, but also a lot of fun! 

    So I decided to try turning it into a weekly thing. The next stream will be on Tuesday, 2PM EST (just like the last time):

    I'll keep posting the updates here, but if you prefer to get them in your email, you can sign-up here:

    https://pages.wokwi.com/rp2040

    See you on Tuesday!

  • 6 Instructions and a Blink

    Uri Shaked01/26/2021 at 22:12 2 comments

    In the first live stream we implemented 6 instructions: B, BL, LSLS, MOVS, PUSH, STR - just the bare minimum to run the main loop of the blink example.

    Eventually, we got it running in the simulation, and also wrote unit tests for most of these instructions. 

    You can find the code in the project's repo: https://github.com/wokwi/rp2040js

    Now, it's your turn: I'd love to get your feedback about the format, and learn if you want me to do more live-streaming sessions showing how I gradually evolve this project into a usable, general-purpose Raspberry Pi Pico emulator.

  • Building the Bootrom

    Uri Shaked01/26/2021 at 13:45 0 comments

    After digging a bit into the RP2040 datasheet, it seems like we might also need to take a look at the bootrom. Fortunately, the full source code is available on GitHub

    There's no documentation how to build it, but it turns out it's pretty straightforward. Here are the complete instructions for building the RP2040 bootrom from source:

    1.  Install dependencies: 
      sudo apt install cmake gcc-arm-none-eabi
    2. Checkout the repository:

      git clone https://github.com/raspberrypi/pico-bootrom
    3.  Build it!

      cd pico-bootrom
      git submodule update --init
      mkdir build
      cd build
      cmake ..
      make -j4 

    Enjoy :-)

  • First live-stream

    Uri Shaked01/25/2021 at 18:54 0 comments

    For the first live-stream tomorrow, we'll use the following documents:

    • Getting started with Raspberry Pi Pico guide (mostly for SDK installation instructions)
    • RP2040 Datasheet
    • ARM® v6-M Architecture Reference Manual

    You can find a copy of all the three documents in the Files section of the project page.

    We'll also use the Pico SDK and Pico Examples repo.

    To save time, I have already set them up on my machine, so we can get straight to planning/coding (without having to wait for the 1.2GB gcc-arm-none-eabi package to download).

    See you tomorrow!