rp2350

#zig#raspberry-pi

git clone https://git.pyrossh.dev/rp2350

code to drive rp2350


readme.md
9f7e5aa 1
# RP2350 Dev Board
9f7e5aa 2
736f723 3
## Setup
736f723 4
1. `brew install zig open-ocd arm-none-eabi-gdb`
8ee2d90 5
2. Test
8ee2d90 6
736f723 7
736f723 8
If open-ocd doesn't work build from source,
736f723 9
736f723 10
`brew remove open-ocd`
736f723 11
`brew install pkg-config autoconf automake texinfo libfdti hidpi jimtcl`
736f723 12
`untar docs/openocd.tar.gz`
736f723 13
`./boostrap`
736f723 14
`./configure --enable-target=rp2350 --enable-interface=jtag`
736f723 15
`make`
736f723 16
`sudo make install`
736f723 17
9f7e5aa 18
## Run
9f7e5aa 19
1. `zig build`
376c0f5 20
2. `picotool load -x zig-out/firmware/rp2350.uf2 -f`
376c0f5 21
376c0f5 22
736f723 23
# Start OCD Server
736f723 24
736f723 25
`sudo openocd -s tcl -f interface/cmsis-dap.cfg -f target/rp2350.cfg -c "adapter speed 5000"sudo openocd -s tcl -f interface/cmsis-dap.cfg -f target/rp2350.cfg -c "adapter speed 5000"`
736f723 26
736f723 27
# Flash OCD Program
736f723 28
736f723 29
`sudo openocd -f interface/cmsis-dap.cfg -f target/rp2350.cfg -c "adapter speed 5000" -c "program zig-out/firmware/rp2350.elf verify reset exit"`
736f723 30
376c0f5 31
```c
376c0f5 32
// Flash allocation map 4MB for pico 2W
376c0f5 33
//
376c0f5 34
// |------------------------------------------------|
376c0f5 35
// |      A         | B |     C     |       D       |
376c0f5 36
// |----------------|---|-----------|---------------|
376c0f5 37
// |      1024K     |64K|  1472K    |     1536K     |
376c0f5 38
// |------------------------------------------------|
376c0f5 39
//                  |----------- flash.c -----------|
376c0f5 40
376c0f5 41
// |------ 1MB -----|------------- 3MB -------------|
376c0f5 42
// |---------------------- 4MB ---------------------|
376c0f5 43
//
376c0f5 44
// - A : binary (firmware)
376c0f5 45
// - B : storage (key-value database)
376c0f5 46
// - C : user program (js)
376c0f5 47
// - D : file system (lfs)
376c0f5 48
// (Total : 4MB)
376c0f5 49
376c0f5 50
// file system on flash (1024K)
376c0f5 51
// - sector base : 400
376c0f5 52
// - sector count : 384
376c0f5 53
// - use block device : new Flash(400, 384)
8ee2d90 54
```