diff --git a/src/rp2_common/hardware_flash/flash.c b/src/rp2_common/hardware_flash/flash.c index f217284a9..53b86f2a8 100644 --- a/src/rp2_common/hardware_flash/flash.c +++ b/src/rp2_common/hardware_flash/flash.c @@ -337,8 +337,8 @@ void flash_devinfo_set_cs_size(uint cs, flash_devinfo_size_t size) { uint cs_shift = cs == 0u ? OTP_DATA_FLASH_DEVINFO_CS0_SIZE_LSB : OTP_DATA_FLASH_DEVINFO_CS1_SIZE_LSB; uint cs_mask = OTP_DATA_FLASH_DEVINFO_CS0_SIZE_BITS >> OTP_DATA_FLASH_DEVINFO_CS0_SIZE_LSB; flash_devinfo_update_field( - (uint)size << cs_shift, - cs_mask << cs_shift + (uint16_t)size << cs_shift, + (uint16_t)cs_mask << cs_shift ); } @@ -364,7 +364,7 @@ void flash_devinfo_set_cs_gpio(uint cs, uint gpio) { invalid_params_if(HARDWARE_FLASH, gpio >= NUM_BANK0_GPIOS); (void)cs; flash_devinfo_update_field( - gpio << OTP_DATA_FLASH_DEVINFO_CS1_GPIO_LSB, + (uint16_t)gpio << OTP_DATA_FLASH_DEVINFO_CS1_GPIO_LSB, OTP_DATA_FLASH_DEVINFO_CS1_GPIO_BITS ); } diff --git a/src/rp2_common/pico_bootrom/bootrom.c b/src/rp2_common/pico_bootrom/bootrom.c index f897da34e..ac3d94bec 100644 --- a/src/rp2_common/pico_bootrom/bootrom.c +++ b/src/rp2_common/pico_bootrom/bootrom.c @@ -76,7 +76,7 @@ void __attribute__((noreturn)) rom_reset_usb_boot_extra(int usb_activity_gpio_pi flags |= BOOTSEL_FLAG_GPIO_PIN_ACTIVE_LOW; } } - rom_reboot(REBOOT2_FLAG_REBOOT_TYPE_BOOTSEL | REBOOT2_FLAG_NO_RETURN_ON_SUCCESS, 10, flags, usb_activity_gpio_pin); + rom_reboot(REBOOT2_FLAG_REBOOT_TYPE_BOOTSEL | REBOOT2_FLAG_NO_RETURN_ON_SUCCESS, 10, flags, usb_activity_gpio_pin >= 0 ? (uint32_t)usb_activity_gpio_pin : NUM_BANK0_GPIOS); __builtin_unreachable(); #else panic_unsupported();