From 6fbbee442752e88f5a428d0932788a8711a2e331 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 7 Jul 2025 17:24:49 -0500 Subject: [PATCH] arm/lpc32xx: Fix prototype mismatch and LPC32XX_SCRATCH_AREA_SIZE use lpc32xx_mlc_write_blocks() had a different prototype in the header from the implementation. Changed to match the prototype and Doxygen. LPC32XX_SCRATCH_AREA_SIZE was tested with "ifdef" not "if" which resulted in it being used as an array size when undefined or set to 0. --- bsps/arm/lpc32xx/include/bsp.h | 4 ++-- bsps/arm/lpc32xx/nand/nand-mlc-write-blocks.c | 6 +++--- bsps/arm/lpc32xx/start/bspstarthooks.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bsps/arm/lpc32xx/include/bsp.h b/bsps/arm/lpc32xx/include/bsp.h index bb779ace16..bf053c1e97 100644 --- a/bsps/arm/lpc32xx/include/bsp.h +++ b/bsps/arm/lpc32xx/include/bsp.h @@ -187,9 +187,9 @@ extern uint32_t lpc32xx_magic_zero_end []; */ extern uint32_t lpc32xx_magic_zero_size []; -#ifdef LPC32XX_SCRATCH_AREA_SIZE +#if LPC32XX_SCRATCH_AREA_SIZE /** - * @rief Scratch area. + * @brief Scratch area. * * The usage is application specific. */ diff --git a/bsps/arm/lpc32xx/nand/nand-mlc-write-blocks.c b/bsps/arm/lpc32xx/nand/nand-mlc-write-blocks.c index 4a4c31964a..eefa71af7e 100644 --- a/bsps/arm/lpc32xx/nand/nand-mlc-write-blocks.c +++ b/bsps/arm/lpc32xx/nand/nand-mlc-write-blocks.c @@ -61,7 +61,7 @@ rtems_status_code lpc32xx_mlc_write_blocks( uint32_t block_end, const void *src, size_t src_size, - uint32_t *page_data_buffer + uint32_t page_buffer [MLC_LARGE_DATA_WORD_COUNT] ) { rtems_status_code sc = RTEMS_SUCCESSFUL; @@ -92,10 +92,10 @@ rtems_status_code lpc32xx_mlc_write_blocks( size_t delta = remainder < page_size ? remainder : page_size; if (remainder > 0) { - memcpy(page_data_buffer, current, delta); + memcpy(page_buffer, current, delta); sc = lpc32xx_mlc_write_page_with_ecc( page, - page_data_buffer, + page_buffer, ones_spare ); if (sc != RTEMS_SUCCESSFUL) { diff --git a/bsps/arm/lpc32xx/start/bspstarthooks.c b/bsps/arm/lpc32xx/start/bspstarthooks.c index 213cb43c19..abe6212f47 100644 --- a/bsps/arm/lpc32xx/start/bspstarthooks.c +++ b/bsps/arm/lpc32xx/start/bspstarthooks.c @@ -68,7 +68,7 @@ .begin = (uint32_t) bsp_section_fast_data_begin, .end = (uint32_t) bsp_section_fast_data_end, .flags = LPC32XX_MMU_READ_WRITE_DATA -#ifdef LPC32XX_SCRATCH_AREA_SIZE +#if LPC32XX_SCRATCH_AREA_SIZE }, { .begin = (uint32_t) &lpc32xx_scratch_area [0], .end = (uint32_t) &lpc32xx_scratch_area [LPC32XX_SCRATCH_AREA_SIZE],