diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/common/cy_network_buffer.c b/targets/TARGET_Cypress/TARGET_PSOC6/common/cy_network_buffer.c index 36f8e95c5fd..69c3c88ce06 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/common/cy_network_buffer.c +++ b/targets/TARGET_Cypress/TARGET_PSOC6/common/cy_network_buffer.c @@ -28,12 +28,13 @@ #include #include "cy_network_buffer.h" #include "cy_utils.h" -#include "memp.h" +#include "lwip/memp.h" #define SDIO_BLOCK_SIZE (64U) whd_result_t cy_host_buffer_get(whd_buffer_t *buffer, whd_buffer_dir_t direction, unsigned short size, unsigned long timeout_ms) { UNUSED_PARAMETER( direction ); + UNUSED_PARAMETER( timeout_ms ); struct pbuf *p = NULL; if ( ( direction == WHD_NETWORK_TX) && ( size <= PBUF_POOL_BUFSIZE ) ) { diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/common/cy_network_buffer.h b/targets/TARGET_Cypress/TARGET_PSOC6/common/cy_network_buffer.h index a8e2aad2c35..637b70e02e8 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/common/cy_network_buffer.h +++ b/targets/TARGET_Cypress/TARGET_PSOC6/common/cy_network_buffer.h @@ -39,7 +39,7 @@ #include "cy_result.h" #include "whd.h" #include "whd_network_types.h" -#include "pbuf.h" +#include "lwip/pbuf.h" #if defined(__cplusplus) extern "C" { diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/common/cy_serial_flash_prog.c b/targets/TARGET_Cypress/TARGET_PSOC6/common/cy_serial_flash_prog.c index 69f416349e0..20bbcdd1236 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/common/cy_serial_flash_prog.c +++ b/targets/TARGET_Cypress/TARGET_PSOC6/common/cy_serial_flash_prog.c @@ -72,7 +72,8 @@ const stc_smif_ipblocks_arr_t smifIpBlocksArr = {&smifBlockConfig, 0x00000000}; * process and programming tools to determine key characteristics about the memory usage including * where the boot process should start the application from and what external memories are connected * (if any). This must consume a full row of flash memory row. The last entry is a checksum of the - * other values in the ToC which must be updated if any other value changes. + * other values in the ToC which must be updated if any other value changes. This can be done manually + * or by running 'cymcuelftool -S' to recompute the checksum. */ CY_SECTION(".cy_toc_part2") __attribute__( (used) ) const uint32_t cyToc[128] = diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/common/cy_serial_flash_qspi.c b/targets/TARGET_Cypress/TARGET_PSOC6/common/cy_serial_flash_qspi.c index 963982b6aa0..a02c4abe0ba 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/common/cy_serial_flash_qspi.c +++ b/targets/TARGET_Cypress/TARGET_PSOC6/common/cy_serial_flash_qspi.c @@ -48,7 +48,7 @@ extern "C" { /* SMIF slot from which the memory configuration is picked up - fixed to 0 as the driver * supports only one device */ -#define MEM_SLOT (0u) +#define MEM_SLOT (0u) /** \endcond */ @@ -123,21 +123,26 @@ cy_rslt_t cy_serial_flash_qspi_init( } } - if((CY_RSLT_SUCCESS == result) && (CY_SMIF_SUCCESS == smifStatus)) + if((CY_RSLT_SUCCESS != result) || (CY_SMIF_SUCCESS != smifStatus)) { - return CY_RSLT_SUCCESS; - } - else - { - Cy_SMIF_MemDeInit(qspi_obj.base); cy_serial_flash_qspi_deinit(); - return (cy_rslt_t)smifStatus; + + if(CY_SMIF_SUCCESS != smifStatus) + { + result = (cy_rslt_t)smifStatus; + } } + + return result; } void cy_serial_flash_qspi_deinit(void) { - Cy_SMIF_MemDeInit(qspi_obj.base); + if (qspi_obj.base != NULL) + { + Cy_SMIF_MemDeInit(qspi_obj.base); + } + cyhal_qspi_free(&qspi_obj); } diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/mbed_overrides.c b/targets/TARGET_Cypress/TARGET_PSOC6/mbed_overrides.c index 3fc9263ff81..17ea0601821 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/mbed_overrides.c +++ b/targets/TARGET_Cypress/TARGET_PSOC6/mbed_overrides.c @@ -23,6 +23,10 @@ #include "mbed_power_mgmt.h" #include "rtos_idle.h" #include "us_ticker_api.h" + +#if defined(CY_ENABLE_XIP_PROGRAM) +#include "cycfg_qspi_memslot.h" +#endif /*defined(CY_ENABLE_XIP_PROGRAM)*/ #if defined(MBED_CONF_TARGET_XIP_ENABLE) #include "cy_serial_flash_qspi.h" #endif /* defined(MBED_CONF_TARGET_XIP_ENABLE) */ @@ -70,31 +74,26 @@ void mbed_sdk_init(void) mailbox_init(); #endif -#if (CY_CPU_CORTEX_M0P) -#if defined(COMPONENT_SPE) /* Set up the device based on configurator selections */ - init_cycfg_all(); -#endif + cybsp_init(); +#if (CY_CPU_CORTEX_M0P) #if !defined(COMPONENT_SPM_MAILBOX) /* Enable global interrupts */ __enable_irq(); #endif #else -#if !defined(TARGET_PSA) - /* Set up the device based on configurator selections */ - cybsp_init(); /* * Init the us Ticker here to avoid imposing on the limited stack space of the idle thread. * This also allows the first call to sleep to occur faster. */ us_ticker_init(); -#endif #if defined(CYBSP_ENABLE_FLASH_STORAGE) /* The linker script allows storing data in external memory, if needed, enable access to that memory. */ - cy_serial_flash_init(); - cy_serial_flash_enable_xip(true); + const uint32_t bus_frequency = 50000000lu; + cy_serial_flash_qspi_init(smifMemConfigs[0], CYBSP_QSPI_D0, CYBSP_QSPI_D1, CYBSP_QSPI_D2, CYBSP_QSPI_D3, NC, NC, NC, NC, CYBSP_QSPI_SCK, CYBSP_QSPI_SS, bus_frequency); + cy_serial_flash_qspi_enable_xip(true); #endif /* Enable global interrupts (disabled in CM4 startup assembly) */