Skip to content

Commit

Permalink
Update rp2040 pico-sdk to latest (1.5.1 with additional bugfixes) (#2667
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mikee47 authored Sep 19, 2023
1 parent ca94c51 commit 1d4f0cc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 30 deletions.
44 changes: 22 additions & 22 deletions Sming/Arch/Rp2040/Components/rp2040/cyw43-driver.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/src/cyw43_ctrl.c b/src/cyw43_ctrl.c
index c6c2df6..753bfa8 100644
index edec1f3..de03c73 100644
--- a/src/cyw43_ctrl.c
+++ b/src/cyw43_ctrl.c
@@ -296,13 +296,17 @@ STATIC const char *const cyw43_async_event_name_table[89] = {
@@ -296,13 +296,17 @@ static const char *const cyw43_async_event_name_table[89] = {
[CYW43_EV_SET_SSID] = "SET_SSID",
[CYW43_EV_JOIN] = "JOIN",
[CYW43_EV_AUTH] = "AUTH",
Expand All @@ -21,11 +21,11 @@ index c6c2df6..753bfa8 100644
[CYW43_EV_ASSOC_REQ_IE] = "ASSOC_REQ_IE",
[CYW43_EV_ASSOC_RESP_IE] = "ASSOC_RESP_IE",
diff --git a/src/cyw43_ll.c b/src/cyw43_ll.c
index 7f4229b..f3bc641 100644
index 604335c..4aeb629 100644
--- a/src/cyw43_ll.c
+++ b/src/cyw43_ll.c
@@ -55,9 +55,6 @@ int sdio_transfer(uint32_t cmd, uint32_t arg, uint32_t *resp);
void sdio_enable_high_speed_4bit(void);
@@ -54,9 +54,6 @@
#include "cyw43_sdio.h"
#endif

-#define CYW43_FLASH_BLOCK_SIZE (512)
Expand All @@ -34,7 +34,7 @@ index 7f4229b..f3bc641 100644
struct pbuf;
uint16_t pbuf_copy_partial(const struct pbuf *p, void *dataptr, uint16_t len, uint16_t offset);

@@ -69,10 +66,6 @@ extern bool enable_spi_packet_dumping;
@@ -68,10 +65,6 @@ extern bool enable_spi_packet_dumping;

#define CYW43_RAM_SIZE (512 * 1024)

Expand All @@ -45,9 +45,9 @@ index 7f4229b..f3bc641 100644
#define VERIFY_FIRMWARE_DOWNLOAD (0)

#define ALIGN_UINT(val, align) (((val) + (align) - 1) & ~((align) - 1))
@@ -377,58 +370,31 @@ static int cyw43_read_backplane_mem(cyw43_int_t *self, uint32_t addr, uint32_t l
@@ -357,58 +350,31 @@ static void cyw43_write_backplane(cyw43_int_t *self, uint32_t addr, size_t size,
cyw43_set_backplane_window(self, CHIPCOMMON_BASE_ADDRESS);
}
#endif

-static int cyw43_download_resource(cyw43_int_t *self, uint32_t addr, size_t raw_len, int from_storage, uintptr_t source) {
- // round up len to simplify download
Expand All @@ -59,7 +59,7 @@ index 7f4229b..f3bc641 100644
- if (from_storage) {
- // reused the spid_buf to copy the data (must be larger than 512 storage block size)
- block_size = sizeof(self->spid_buf);
- CYW43_DEBUG("data comes from external storage via buffer of size %u\n", (uint)block_size);
- CYW43_DEBUG("data comes from external storage via buffer of size %u\n", (unsigned int)block_size);
+static uint32_t storage_get_chunksize()
+{
+ const uint32_t chunkTag = 0x4b4e4843; // "CHNK"
Expand Down Expand Up @@ -126,7 +126,7 @@ index 7f4229b..f3bc641 100644

#if VERIFY_FIRMWARE_DOWNLOAD
uint32_t t_start = cyw43_hal_ticks_us();
@@ -446,7 +412,7 @@ static int cyw43_download_resource(cyw43_int_t *self, uint32_t addr, size_t raw_
@@ -426,7 +392,7 @@ static int cyw43_download_resource(cyw43_int_t *self, uint32_t addr, size_t raw_
cyw43_set_backplane_window(self, dest_addr);
const uint8_t *src;
if (from_storage) {
Expand All @@ -135,7 +135,7 @@ index 7f4229b..f3bc641 100644
src = self->spid_buf;
} else {
src = (const uint8_t *)source + offset;
@@ -459,6 +425,10 @@ static int cyw43_download_resource(cyw43_int_t *self, uint32_t addr, size_t raw_
@@ -443,6 +409,10 @@ static int cyw43_download_resource(cyw43_int_t *self, uint32_t addr, size_t raw_
}

#if VERIFY_FIRMWARE_DOWNLOAD
Expand All @@ -145,8 +145,8 @@ index 7f4229b..f3bc641 100644
+ }
uint32_t t_end = cyw43_hal_ticks_us();
uint32_t dt = t_end - t_start;
CYW43_VDEBUG("done dnload; dt = %u us; speed = %u kbytes/sec\n", (uint)dt, (uint)(len * 1000 / dt));
@@ -480,7 +450,7 @@ static int cyw43_download_resource(cyw43_int_t *self, uint32_t addr, size_t raw_
CYW43_VDEBUG("done dnload; dt = %u us; speed = %u kbytes/sec\n", (unsigned int)dt, (unsigned int)(len * 1000 / dt));
@@ -464,7 +434,7 @@ static int cyw43_download_resource(cyw43_int_t *self, uint32_t addr, size_t raw_
cyw43_read_bytes(self, BACKPLANE_FUNCTION, dest_addr & BACKPLANE_ADDR_MASK, sz, buf);
const uint8_t *src;
if (from_storage) {
Expand All @@ -155,7 +155,7 @@ index 7f4229b..f3bc641 100644
src = self->spid_buf;
} else {
src = (const uint8_t *)source + offset;
@@ -1383,8 +1353,8 @@ void cyw43_ll_bus_sleep(cyw43_ll_t *self_in, bool can_sleep) {
@@ -1372,8 +1342,8 @@ void cyw43_ll_bus_sleep(cyw43_ll_t *self_in, bool can_sleep) {
#define CLM_CHUNK_LEN 1024 + 512
#endif

Expand All @@ -166,7 +166,7 @@ index 7f4229b..f3bc641 100644
uint8_t *buf = &self->spid_buf[SDPCM_HEADER_LEN + 16];

const size_t clm_dload_chunk_len = CLM_CHUNK_LEN;
@@ -1409,7 +1379,7 @@ static void cyw43_clm_load(cyw43_int_t *self, const uint8_t *clm_ptr, size_t clm
@@ -1398,7 +1368,7 @@ static void cyw43_clm_load(cyw43_int_t *self, const uint8_t *clm_ptr, size_t clm
*(uint32_t *)(buf + 12) = len;
*(uint32_t *)(buf + 16) = 0;
#pragma GCC diagnostic pop
Expand All @@ -175,7 +175,7 @@ index 7f4229b..f3bc641 100644

CYW43_VDEBUG("clm data send %lu/%zu\n", off + len, clm_len);

@@ -1665,12 +1635,9 @@ alp_set:
@@ -1654,12 +1624,9 @@ alp_set:
cyw43_write_backplane(self, SOCSRAM_BANKX_INDEX, 4, 0x3);
cyw43_write_backplane(self, SOCSRAM_BANKX_PDA, 4, 0);

Expand All @@ -190,7 +190,7 @@ index 7f4229b..f3bc641 100644

size_t wifi_nvram_len = ALIGN_UINT(sizeof(wifi_nvram_4343), 64);
const uint8_t *wifi_nvram_data = wifi_nvram_4343;
@@ -1787,9 +1754,11 @@ f2_ready:
@@ -1776,9 +1743,11 @@ f2_ready:

// Load the CLM data; it sits just after main firmware
CYW43_VDEBUG("cyw43_clm_load start\n");
Expand All @@ -203,7 +203,7 @@ index 7f4229b..f3bc641 100644
cyw43_write_iovar_u32(self, "bus:txglom", 0, WWD_STA_INTERFACE); // tx glomming off
cyw43_write_iovar_u32(self, "apsta", 1, WWD_STA_INTERFACE); // apsta on

@@ -1893,6 +1862,10 @@ int cyw43_ll_wifi_on(cyw43_ll_t *self_in, uint32_t country) {
@@ -1882,6 +1851,10 @@ int cyw43_ll_wifi_on(cyw43_ll_t *self_in, uint32_t country) {
cyw43_delay_ms(50);

#ifndef NDEBUG
Expand All @@ -214,7 +214,7 @@ index 7f4229b..f3bc641 100644
// Get and print CLM version
memcpy(buf, "clmver\x00", 7);
cyw43_do_ioctl(self, SDPCM_GET, WLC_GET_VAR, 128, buf, WWD_STA_INTERFACE);
@@ -1922,8 +1895,8 @@ int cyw43_ll_wifi_on(cyw43_ll_t *self_in, uint32_t country) {
@@ -1911,8 +1884,8 @@ int cyw43_ll_wifi_on(cyw43_ll_t *self_in, uint32_t country) {
CLR_EV(buf, 19); // roam attempt occurred
CLR_EV(buf, 20); // tx fail
CLR_EV(buf, 40); // radio
Expand All @@ -225,10 +225,10 @@ index 7f4229b..f3bc641 100644
#undef CLR_EV
memcpy(buf, "bsscfg:event_msgs", 18);
diff --git a/src/cyw43_ll.h b/src/cyw43_ll.h
index cf442db..a7ad227 100644
index 2750238..c281093 100644
--- a/src/cyw43_ll.h
+++ b/src/cyw43_ll.h
@@ -65,15 +65,19 @@
@@ -67,15 +67,19 @@
#define CYW43_EV_SET_SSID (0)
#define CYW43_EV_JOIN (1)
#define CYW43_EV_AUTH (3)
Expand All @@ -248,7 +248,7 @@ index cf442db..a7ad227 100644
#define CYW43_EV_CSA_COMPLETE_IND (80)
#define CYW43_EV_ASSOC_REQ_IE (87)
#define CYW43_EV_ASSOC_RESP_IE (88)
@@ -312,6 +316,11 @@ uint32_t cyw43_ll_read_backplane_reg(cyw43_ll_t *self_in, uint32_t addr);
@@ -318,6 +322,11 @@ uint32_t cyw43_ll_read_backplane_reg(cyw43_ll_t *self_in, uint32_t addr);
int cyw43_ll_write_backplane_mem(cyw43_ll_t *self_in, uint32_t addr, uint32_t len, const uint8_t *buf);
int cyw43_ll_read_backplane_mem(cyw43_ll_t *self_in, uint32_t addr, uint32_t len, uint8_t *buf);

Expand Down
2 changes: 1 addition & 1 deletion Sming/Arch/Rp2040/Components/rp2040/pico-sdk
Submodule pico-sdk updated 57 files
+1 −2 .github/workflows/macOS.yml
+1 −1 CONTRIBUTING.md
+2 −1 docs/index.h
+1 −1 docs/mainpage.md
+1 −1 lib/btstack
+1 −1 lib/cyw43-driver
+1 −1 pico_sdk_version.cmake
+1 −1 src/board_setup.cmake
+1 −1 src/boards/generic_board.cmake
+1 −1 src/boards/include/boards/adafruit_itsybitsy_rp2040.h
+3 −2 src/boards/include/boards/pico.h
+8 −3 src/boards/include/boards/pico_w.h
+1 −0 src/common/pico_base/include/pico/error.h
+1 −1 src/common/pico_time/time.c
+16,526 −16,512 src/rp2040/hardware_regs/rp2040.svd
+1 −0 src/rp2_common/CMakeLists.txt
+1 −1 src/rp2_common/boot_stage2/boot2_is25lp080.S
+3 −3 src/rp2_common/hardware_divider/include/hardware/divider.h
+12 −0 src/rp2_common/hardware_dma/dma.c
+19 −0 src/rp2_common/hardware_dma/include/hardware/dma.h
+1 −1 src/rp2_common/hardware_gpio/include/hardware/gpio.h
+11 −9 src/rp2_common/hardware_sync/include/hardware/sync.h
+43 −27 src/rp2_common/hardware_uart/include/hardware/uart.h
+102 −8 src/rp2_common/hardware_uart/uart.c
+2 −1 src/rp2_common/pico_async_context/async_context_threadsafe_background.c
+4 −0 src/rp2_common/pico_async_context/include/pico/async_context.h
+1 −1 src/rp2_common/pico_async_context/include/pico/async_context_freertos.h
+1 −1 src/rp2_common/pico_bootrom/include/pico/bootrom.h
+4 −1 src/rp2_common/pico_btstack/CMakeLists.txt
+50 −17 src/rp2_common/pico_btstack/btstack_flash_bank.c
+18 −1 src/rp2_common/pico_cyw43_arch/cyw43_arch.c
+2 −1 src/rp2_common/pico_cyw43_arch/cyw43_arch_poll.c
+18 −1 src/rp2_common/pico_cyw43_arch/include/pico/cyw43_arch.h
+20 −18 src/rp2_common/pico_cyw43_driver/cybt_shared_bus/cybt_shared_bus_driver.c
+19 −16 src/rp2_common/pico_cyw43_driver/cyw43_bus_pio_spi.c
+12 −0 src/rp2_common/pico_flash/CMakeLists.txt
+221 −0 src/rp2_common/pico_flash/flash.c
+142 −0 src/rp2_common/pico_flash/include/pico/flash.h
+1 −1 src/rp2_common/pico_lwip/CMakeLists.txt
+12 −0 src/rp2_common/pico_multicore/include/pico/multicore.h
+16 −3 src/rp2_common/pico_multicore/multicore.c
+18 −5 src/rp2_common/pico_platform/include/pico/platform.h
+3 −5 src/rp2_common/pico_standard_link/CMakeLists.txt
+20 −4 src/rp2_common/pico_standard_link/crt0.S
+2 −2 src/rp2_common/pico_standard_link/memmap_blocked_ram.ld
+2 −2 src/rp2_common/pico_standard_link/memmap_copy_to_ram.ld
+2 −2 src/rp2_common/pico_standard_link/memmap_default.ld
+2 −2 src/rp2_common/pico_standard_link/memmap_no_flash.ld
+9 −3 src/rp2_common/pico_stdio_usb/stdio_usb_descriptors.c
+16 −0 src/rp2_common/pico_stdlib/stdlib.c
+1 −0 test/kitchen_sink/CMakeLists.txt
+1 −0 test/kitchen_sink/kitchen_sink.c
+14 −9 tools/CMakeLists.txt
+1 −1 tools/elf2uf2/CMakeLists.txt
+1 −1 tools/pioasm/CMakeLists.txt
+0 −1 tools/pioasm/pio_disassembler.cpp
+1 −0 tools/pioasm/pio_disassembler.h
8 changes: 1 addition & 7 deletions Sming/Arch/Rp2040/Components/rp2040/pico-sdk.patch
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
diff --git a/lib/cyw43-driver b/lib/cyw43-driver
--- a/lib/cyw43-driver
+++ b/lib/cyw43-driver
@@ -1 +1 @@
-Subproject commit 9bfca61173a94432839cd39210f1d1afdf602c42
+Subproject commit 9bfca61173a94432839cd39210f1d1afdf602c42-dirty
diff --git a/src/common/pico_util/queue.c b/src/common/pico_util/queue.c
index a5c8e18..c3b8a91 100644
--- a/src/common/pico_util/queue.c
Expand Down Expand Up @@ -50,7 +44,7 @@ index 8e92d8b..da5feac 100644
/*! \brief Atomically set the specified bits to 1 in a HW register
* \ingroup hardware_base
diff --git a/src/rp2_common/pico_standard_link/memmap_default.ld b/src/rp2_common/pico_standard_link/memmap_default.ld
index 638e994..3fb53cd 100644
index e85b327..cf826c6 100644
--- a/src/rp2_common/pico_standard_link/memmap_default.ld
+++ b/src/rp2_common/pico_standard_link/memmap_default.ld
@@ -231,7 +231,7 @@ SECTIONS
Expand Down

0 comments on commit 1d4f0cc

Please sign in to comment.