Attempting to compile without this fix results in this error
```
main.c:226:9: error: 'cs' undeclared (first use in this function)
226 | cs = readbyte_blocking();
| ^~
```
This fix declares `cs` as a `uint8_t`. Tested and was able to read/write to a MX25L6406E and MX25L3206E
Should fix bug: https://codeberg.org/libreboot/lbmk/issues/182
Declaration aren't allowed immediately after labels. Some compilers
are apparently more strict about this, mine didn't even warn about it.
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
When SPI interface is enabled, no chip selects should be floating.
That can cause issues, for example if such a pin is connected to a
flash chip with no pull-ups on board.
So, enable RP2040's internal pull-ups on those pins.
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
now, GP5..8 are available as cs=0..3
GP5 is still the default one, which is defaulted to on power-up.
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
some boards don't define PICO_DEFAULT_LED_PIN, so compiling would fail.
let's make led commands conditional on that being defined.
some boards have ws2812 addressable rgb leds, which could be supported
in the future, if someone wanted to implement it.
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
For now, set a description and link to the code, plus pin definitions:
$ picotool info -bp *.uf2
File pico_serprog.uf2:
Program Information
name: pico_serprog
web site: https://codeberg.org/Riku_V/pico-serprog/
description: SPI flash chip programmer using Flashrom's serprog protocol
Fixed Pin Information
2: SCK
3: MOSI
4: MISO
5: CS
25: Activity LED
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>
iManufacturer=libreboot.org
iProduct=pico-serprog
iInterface=serprog
iSerial=64-bit ID, unique to each board (actually flash chip)
Since VID and PID are unchanged, functionality stays the same. This makes
it easier to identify the programmer, whether manually or in udev rules.
lsusb output:
Bus 002 Device 025: ID cafe:4001 libreboot.org pico-serprog
dmesg output:
usb 2-1.2: new full-speed USB device number 25 using ehci-pci
usb 2-1.2: New USB device found, idVendor=cafe, idProduct=4001, bcdDevice= 1.00
usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 2-1.2: Product: pico-serprog
usb 2-1.2: Manufacturer: libreboot.org
usb 2-1.2: SerialNumber: E661A4D417788C29
cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device
Signed-off-by: Riku Viitanen <riku.viitanen@protonmail.com>