Skip to content

Commit

Permalink
lib: Update rp2040_flash to upstream picotool.git v2.0.0
Browse files Browse the repository at this point in the history
This is in preparation for adding rp2350 flash support.

Signed-off-by: Kevin O'Connor <[email protected]>
  • Loading branch information
KevinOConnor committed Nov 14, 2024
1 parent 06bb49f commit 64ba37c
Show file tree
Hide file tree
Showing 9 changed files with 877 additions and 78 deletions.
4 changes: 3 additions & 1 deletion lib/README
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ taken from the tools/elf2uf2/ directory.
The rp2040_flash directory contains a light-weight bootsel flash tool.
It uses C part of the the `picoboot_connection` directory found in:
https://github.com/raspberrypi/picotool.git
version v1.1.0 (55fd880c3dc029b961fc1a0967a6cfdc0af02721).
version 2.0.0 (8a9af99ab10b20b1c6afb30cd9384e562a6647f9). Note that
Makefile and main.c are locally developed files (the remaining files
are from the picotool repo).

The hub-ctrl directory contains code from:
https://github.com/codazoda/hub-ctrl.c/
Expand Down
42 changes: 42 additions & 0 deletions lib/pico-sdk/boot/picoboot_constants.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

#ifndef _BOOT_PICOBOOT_CONSTANTS_H
#define _BOOT_PICOBOOT_CONSTANTS_H

#define REBOOT2_TYPE_MASK 0x0f

// note these match REBOOT_TYPE in pico/bootrom_constants.h (also 0 is used for PC_SP for backwards compatibility with RP2040)
// values 0-7 are secure/non-secure
#define REBOOT2_FLAG_REBOOT_TYPE_NORMAL 0x0 // param0 = diagnostic partition
#define REBOOT2_FLAG_REBOOT_TYPE_BOOTSEL 0x2 // param0 = bootsel_flags, param1 = gpio_config
#define REBOOT2_FLAG_REBOOT_TYPE_RAM_IMAGE 0x3 // param0 = image_base, param1 = image_end
#define REBOOT2_FLAG_REBOOT_TYPE_FLASH_UPDATE 0x4 // param0 = update_base

// values 8-15 are secure only
#define REBOOT2_FLAG_REBOOT_TYPE_PC_SP 0xd

#define REBOOT2_FLAG_REBOOT_TO_ARM 0x10
#define REBOOT2_FLAG_REBOOT_TO_RISCV 0x20

#define REBOOT2_FLAG_NO_RETURN_ON_SUCCESS 0x100

#define BOOTSEL_FLAG_DISABLE_MSD_INTERFACE 0x01
#define BOOTSEL_FLAG_DISABLE_PICOBOOT_INTERFACE 0x02
#define BOOTSEL_FLAG_GPIO_PIN_ACTIVE_LOW 0x10
#define BOOTSEL_FLAG_GPIO_PIN_SPECIFIED 0x20

#define PICOBOOT_GET_INFO_SYS 1
#define PICOBOOT_GET_INFO_PARTTION_TABLE 2
#define PICOBOOT_GET_INFO_UF2_TARGET_PARTITION 3
#define PICOBOOT_GET_INFO_UF2_STATUS 4

#define UF2_STATUS_IGNORED_FAMILY 0x01
#define UF2_STATUS_ABORT_EXCLUSIVELY_LOCKED 0x10
#define UF2_STATUS_ABORT_BAD_ADDRESS 0x20
#define UF2_STATUS_ABORT_WRITE_ERROR 0x40
#define UF2_STATUS_ABORT_REBOOT_FAILED 0x80
#endif
31 changes: 31 additions & 0 deletions lib/pico-sdk/hardware/platform_defs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

#ifndef _HARDWARE_PLATFORM_DEFS_H
#define _HARDWARE_PLATFORM_DEFS_H

#define NUM_CORES 2u

#define NUM_DMA_CHANNELS 12u

#define NUM_GENERIC_TIMERS 1u
#define NUM_ALARMS 4u

#define NUM_IRQS 32u

#define NUM_SPIN_LOCKS 32u

#define XOSC_HZ 12000000u

#define NUM_SPIN_LOCKS 32u

#define NUM_BANK0_GPIOS 30

#ifndef _u
#define _u(x) x ## u
#endif

#endif
Loading

0 comments on commit 64ba37c

Please sign in to comment.