Skip to content

Commit db0df6b

Browse files
authored
Merge pull request #11800 from morser499/pr/mbed-overrides
Update common Cypress libraries
2 parents 0d0120a + 3098003 commit db0df6b

File tree

5 files changed

+28
-22
lines changed

5 files changed

+28
-22
lines changed

targets/TARGET_Cypress/TARGET_PSOC6/common/cy_network_buffer.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@
2828
#include <stdlib.h>
2929
#include "cy_network_buffer.h"
3030
#include "cy_utils.h"
31-
#include "memp.h"
31+
#include "lwip/memp.h"
3232
#define SDIO_BLOCK_SIZE (64U)
3333

3434
whd_result_t cy_host_buffer_get(whd_buffer_t *buffer, whd_buffer_dir_t direction, unsigned short size, unsigned long timeout_ms)
3535
{
3636
UNUSED_PARAMETER( direction );
37+
UNUSED_PARAMETER( timeout_ms );
3738
struct pbuf *p = NULL;
3839
if ( ( direction == WHD_NETWORK_TX) && ( size <= PBUF_POOL_BUFSIZE ) )
3940
{

targets/TARGET_Cypress/TARGET_PSOC6/common/cy_network_buffer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include "cy_result.h"
4040
#include "whd.h"
4141
#include "whd_network_types.h"
42-
#include "pbuf.h"
42+
#include "lwip/pbuf.h"
4343

4444
#if defined(__cplusplus)
4545
extern "C" {

targets/TARGET_Cypress/TARGET_PSOC6/common/cy_serial_flash_prog.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ const stc_smif_ipblocks_arr_t smifIpBlocksArr = {&smifBlockConfig, 0x00000000};
7272
* process and programming tools to determine key characteristics about the memory usage including
7373
* where the boot process should start the application from and what external memories are connected
7474
* (if any). This must consume a full row of flash memory row. The last entry is a checksum of the
75-
* other values in the ToC which must be updated if any other value changes.
75+
* other values in the ToC which must be updated if any other value changes. This can be done manually
76+
* or by running 'cymcuelftool -S' to recompute the checksum.
7677
*/
7778
CY_SECTION(".cy_toc_part2") __attribute__( (used) )
7879
const uint32_t cyToc[128] =

targets/TARGET_Cypress/TARGET_PSOC6/common/cy_serial_flash_qspi.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ extern "C" {
4848

4949
/* SMIF slot from which the memory configuration is picked up - fixed to 0 as the driver
5050
* supports only one device */
51-
#define MEM_SLOT (0u)
51+
#define MEM_SLOT (0u)
5252

5353
/** \endcond */
5454

@@ -123,21 +123,26 @@ cy_rslt_t cy_serial_flash_qspi_init(
123123
}
124124
}
125125

126-
if((CY_RSLT_SUCCESS == result) && (CY_SMIF_SUCCESS == smifStatus))
126+
if((CY_RSLT_SUCCESS != result) || (CY_SMIF_SUCCESS != smifStatus))
127127
{
128-
return CY_RSLT_SUCCESS;
129-
}
130-
else
131-
{
132-
Cy_SMIF_MemDeInit(qspi_obj.base);
133128
cy_serial_flash_qspi_deinit();
134-
return (cy_rslt_t)smifStatus;
129+
130+
if(CY_SMIF_SUCCESS != smifStatus)
131+
{
132+
result = (cy_rslt_t)smifStatus;
133+
}
135134
}
135+
136+
return result;
136137
}
137138

138139
void cy_serial_flash_qspi_deinit(void)
139140
{
140-
Cy_SMIF_MemDeInit(qspi_obj.base);
141+
if (qspi_obj.base != NULL)
142+
{
143+
Cy_SMIF_MemDeInit(qspi_obj.base);
144+
}
145+
141146
cyhal_qspi_free(&qspi_obj);
142147
}
143148

targets/TARGET_Cypress/TARGET_PSOC6/mbed_overrides.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
#include "mbed_power_mgmt.h"
2424
#include "rtos_idle.h"
2525
#include "us_ticker_api.h"
26+
27+
#if defined(CY_ENABLE_XIP_PROGRAM)
28+
#include "cycfg_qspi_memslot.h"
29+
#endif /*defined(CY_ENABLE_XIP_PROGRAM)*/
2630
#if defined(MBED_CONF_TARGET_XIP_ENABLE)
2731
#include "cy_serial_flash_qspi.h"
2832
#endif /* defined(MBED_CONF_TARGET_XIP_ENABLE) */
@@ -70,31 +74,26 @@ void mbed_sdk_init(void)
7074
mailbox_init();
7175
#endif
7276

73-
#if (CY_CPU_CORTEX_M0P)
74-
#if defined(COMPONENT_SPE)
7577
/* Set up the device based on configurator selections */
76-
init_cycfg_all();
77-
#endif
78+
cybsp_init();
7879

80+
#if (CY_CPU_CORTEX_M0P)
7981
#if !defined(COMPONENT_SPM_MAILBOX)
8082
/* Enable global interrupts */
8183
__enable_irq();
8284
#endif
8385
#else
84-
#if !defined(TARGET_PSA)
85-
/* Set up the device based on configurator selections */
86-
cybsp_init();
8786
/*
8887
* Init the us Ticker here to avoid imposing on the limited stack space of the idle thread.
8988
* This also allows the first call to sleep to occur faster.
9089
*/
9190
us_ticker_init();
92-
#endif
9391

9492
#if MBED_CONF_TARGET_XIP_ENABLE
9593
/* The linker script allows storing data in external memory, if needed, enable access to that memory. */
96-
cy_serial_flash_init();
97-
cy_serial_flash_enable_xip(true);
94+
const uint32_t bus_frequency = 50000000lu;
95+
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);
96+
cy_serial_flash_qspi_enable_xip(true);
9897
#endif
9998

10099
/* Enable global interrupts (disabled in CM4 startup assembly) */

0 commit comments

Comments
 (0)