From ff2e2028ea749c81514c69620776a654498399a8 Mon Sep 17 00:00:00 2001 From: Andre Zeps Date: Fri, 12 Jan 2024 22:55:43 +0100 Subject: [PATCH] Fixes #1468 (#1497) * Fixes shadowing of a global declaration Required for GCC 12.2.1 * Change other function pointers to be _func to be consistent --------- Co-authored-by: Andre Zeps Co-authored-by: Graham Sanderson --- src/rp2_common/hardware_flash/flash.c | 46 +++++++++++++-------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/rp2_common/hardware_flash/flash.c b/src/rp2_common/hardware_flash/flash.c index 970f0bf06..1423fdb2b 100644 --- a/src/rp2_common/hardware_flash/flash.c +++ b/src/rp2_common/hardware_flash/flash.c @@ -66,20 +66,20 @@ void __no_inline_not_in_flash_func(flash_range_erase)(uint32_t flash_offs, size_ #endif invalid_params_if(FLASH, flash_offs & (FLASH_SECTOR_SIZE - 1)); invalid_params_if(FLASH, count & (FLASH_SECTOR_SIZE - 1)); - rom_connect_internal_flash_fn connect_internal_flash = (rom_connect_internal_flash_fn)rom_func_lookup_inline(ROM_FUNC_CONNECT_INTERNAL_FLASH); - rom_flash_exit_xip_fn flash_exit_xip = (rom_flash_exit_xip_fn)rom_func_lookup_inline(ROM_FUNC_FLASH_EXIT_XIP); - rom_flash_range_erase_fn flash_range_erase = (rom_flash_range_erase_fn)rom_func_lookup_inline(ROM_FUNC_FLASH_RANGE_ERASE); - rom_flash_flush_cache_fn flash_flush_cache = (rom_flash_flush_cache_fn)rom_func_lookup_inline(ROM_FUNC_FLASH_FLUSH_CACHE); - assert(connect_internal_flash && flash_exit_xip && flash_range_erase && flash_flush_cache); + rom_connect_internal_flash_fn connect_internal_flash_func = (rom_connect_internal_flash_fn)rom_func_lookup_inline(ROM_FUNC_CONNECT_INTERNAL_FLASH); + rom_flash_exit_xip_fn flash_exit_xip_func = (rom_flash_exit_xip_fn)rom_func_lookup_inline(ROM_FUNC_FLASH_EXIT_XIP); + rom_flash_range_erase_fn flash_range_erase_func = (rom_flash_range_erase_fn)rom_func_lookup_inline(ROM_FUNC_FLASH_RANGE_ERASE); + rom_flash_flush_cache_fn flash_flush_cache_func = (rom_flash_flush_cache_fn)rom_func_lookup_inline(ROM_FUNC_FLASH_FLUSH_CACHE); + assert(connect_internal_flash_func && flash_exit_xip_func && flash_range_erase_func && flash_flush_cache_func); flash_init_boot2_copyout(); // No flash accesses after this point __compiler_memory_barrier(); - connect_internal_flash(); - flash_exit_xip(); - flash_range_erase(flash_offs, count, FLASH_BLOCK_SIZE, FLASH_BLOCK_ERASE_CMD); - flash_flush_cache(); // Note this is needed to remove CSn IO force as well as cache flushing + connect_internal_flash_func(); + flash_exit_xip_func(); + flash_range_erase_func(flash_offs, count, FLASH_BLOCK_SIZE, FLASH_BLOCK_ERASE_CMD); + flash_flush_cache_func(); // Note this is needed to remove CSn IO force as well as cache flushing flash_enable_xip_via_boot2(); } @@ -89,18 +89,18 @@ void __no_inline_not_in_flash_func(flash_range_program)(uint32_t flash_offs, con #endif invalid_params_if(FLASH, flash_offs & (FLASH_PAGE_SIZE - 1)); invalid_params_if(FLASH, count & (FLASH_PAGE_SIZE - 1)); - rom_connect_internal_flash_fn connect_internal_flash = (rom_connect_internal_flash_fn)rom_func_lookup_inline(ROM_FUNC_CONNECT_INTERNAL_FLASH); - rom_flash_exit_xip_fn flash_exit_xip = (rom_flash_exit_xip_fn)rom_func_lookup_inline(ROM_FUNC_FLASH_EXIT_XIP); - rom_flash_range_program_fn flash_range_program = (rom_flash_range_program_fn)rom_func_lookup_inline(ROM_FUNC_FLASH_RANGE_PROGRAM); + rom_connect_internal_flash_fn connect_internal_flash_func = (rom_connect_internal_flash_fn)rom_func_lookup_inline(ROM_FUNC_CONNECT_INTERNAL_FLASH); + rom_flash_exit_xip_fn flash_exit_xip_func = (rom_flash_exit_xip_fn)rom_func_lookup_inline(ROM_FUNC_FLASH_EXIT_XIP); + rom_flash_range_program_fn flash_range_program_func = (rom_flash_range_program_fn)rom_func_lookup_inline(ROM_FUNC_FLASH_RANGE_PROGRAM); rom_flash_flush_cache_fn flash_flush_cache = (rom_flash_flush_cache_fn)rom_func_lookup_inline(ROM_FUNC_FLASH_FLUSH_CACHE); - assert(connect_internal_flash && flash_exit_xip && flash_range_program && flash_flush_cache); + assert(connect_internal_flash_func && flash_exit_xip_func && flash_range_program_func && flash_flush_cache); flash_init_boot2_copyout(); __compiler_memory_barrier(); - connect_internal_flash(); - flash_exit_xip(); - flash_range_program(flash_offs, data, count); + connect_internal_flash_func(); + flash_exit_xip_func(); + flash_range_program_func(flash_offs, data, count); flash_flush_cache(); // Note this is needed to remove CSn IO force as well as cache flushing flash_enable_xip_via_boot2(); } @@ -122,14 +122,14 @@ static void __no_inline_not_in_flash_func(flash_cs_force)(bool high) { } void __no_inline_not_in_flash_func(flash_do_cmd)(const uint8_t *txbuf, uint8_t *rxbuf, size_t count) { - rom_connect_internal_flash_fn connect_internal_flash = (rom_connect_internal_flash_fn)rom_func_lookup_inline(ROM_FUNC_CONNECT_INTERNAL_FLASH); - rom_flash_exit_xip_fn flash_exit_xip = (rom_flash_exit_xip_fn)rom_func_lookup_inline(ROM_FUNC_FLASH_EXIT_XIP); - rom_flash_flush_cache_fn flash_flush_cache = (rom_flash_flush_cache_fn)rom_func_lookup_inline(ROM_FUNC_FLASH_FLUSH_CACHE); - assert(connect_internal_flash && flash_exit_xip && flash_flush_cache); + rom_connect_internal_flash_fn connect_internal_flash_func = (rom_connect_internal_flash_fn)rom_func_lookup_inline(ROM_FUNC_CONNECT_INTERNAL_FLASH); + rom_flash_exit_xip_fn flash_exit_xip_func = (rom_flash_exit_xip_fn)rom_func_lookup_inline(ROM_FUNC_FLASH_EXIT_XIP); + rom_flash_flush_cache_fn flash_flush_cache_func = (rom_flash_flush_cache_fn)rom_func_lookup_inline(ROM_FUNC_FLASH_FLUSH_CACHE); + assert(connect_internal_flash_func && flash_exit_xip_func && flash_flush_cache_func); flash_init_boot2_copyout(); __compiler_memory_barrier(); - connect_internal_flash(); - flash_exit_xip(); + connect_internal_flash_func(); + flash_exit_xip_func(); flash_cs_force(0); size_t tx_remaining = count; @@ -151,7 +151,7 @@ void __no_inline_not_in_flash_func(flash_do_cmd)(const uint8_t *txbuf, uint8_t * } flash_cs_force(1); - flash_flush_cache(); + flash_flush_cache_func(); flash_enable_xip_via_boot2(); } #endif