Skip to content

Commit

Permalink
PSOC6: move mbed_sdk_init to mbed_overrides.c
Browse files Browse the repository at this point in the history
Purposes:
* Remove MbedOS-specific code from system_psoc6_{cm4,cm0plus}.c
  to simplify updates to new PDL version (startup code is part of PDL).
* Unify mbed_sdk_init initialization sequence for both CPU cores.
  This change is non-functional, sequence itself is not changed for any
  of the PSoC 6 M4/M0 PSA/non-PSA targets.
  • Loading branch information
vmedcy committed Apr 23, 2019
1 parent 46603f8 commit c98f91e
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 302 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,12 @@
* limitations under the License.
*******************************************************************************/

#include <stdint.h>
#include <stdbool.h>
#include "cy_device.h"
#include "device.h"
#include "system_psoc6.h"
#include "cy_device.h"
#include "cy_device_headers.h"
#include "psoc6_utils.h"
#include "cy_syslib.h"
#include "cy_wdt.h"
#include "cycfg.h"

#if !defined(CY_IPC_DEFAULT_CFG_DISABLE)
#include "cy_ipc_sema.h"
Expand All @@ -43,10 +39,6 @@
#endif /* defined(CY_DEVICE_PSOC6ABLE2) */
#endif /* !defined(CY_IPC_DEFAULT_CFG_DISABLE) */

#if defined(COMPONENT_SPM_MAILBOX)
void mailbox_init(void);
#endif


/*******************************************************************************
* SystemCoreClockUpdate()
Expand Down Expand Up @@ -271,41 +263,6 @@ void SystemInit(void)
}


/*******************************************************************************
* Function Name: mbed_sdk_init
****************************************************************************//**
*
* Mbed's post-memory-initialization function.
* Used here to initialize common parts of the Cypress libraries.
*
*******************************************************************************/
void mbed_sdk_init(void)
{
#if !defined(COMPONENT_SPM_MAILBOX)
/* Disable global interrupts */
__disable_irq();
#endif

/* Initialize shared resource manager */
cy_srm_initialize();

/* Initialize system and clocks. */
/* Placed here as it must be done after proper LIBC initialization. */
SystemInit();

#if defined(COMPONENT_SPM_MAILBOX)
mailbox_init();
#endif

/* Set up the device based on configurator selections */
init_cycfg_all();

/* Enable global interrupts */
__enable_irq();
}



/*******************************************************************************
* Function Name: Cy_SystemInit
****************************************************************************//**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,12 @@
* limitations under the License.
*******************************************************************************/

#include <stdint.h>
#include <stdbool.h>
#include "cy_device.h"
#include "device.h"
#include "system_psoc6.h"
#include "cy_device.h"
#include "cy_device_headers.h"
#include "psoc6_utils.h"
#include "cy_syslib.h"
#include "cy_wdt.h"
#include "cycfg.h"

#if !defined(CY_IPC_DEFAULT_CFG_DISABLE)
#include "cy_ipc_sema.h"
Expand All @@ -43,10 +39,6 @@
#endif /* defined(CY_DEVICE_PSOC6ABLE2) */
#endif /* !defined(CY_IPC_DEFAULT_CFG_DISABLE) */

#if defined(COMPONENT_SPM_MAILBOX)
void mailbox_init(void);
#endif


/*******************************************************************************
* SystemCoreClockUpdate()
Expand Down Expand Up @@ -271,41 +263,6 @@ void SystemInit(void)
}


/*******************************************************************************
* Function Name: mbed_sdk_init
****************************************************************************//**
*
* Mbed's post-memory-initialization function.
* Used here to initialize common parts of the Cypress libraries.
*
*******************************************************************************/
void mbed_sdk_init(void)
{
#if !defined(COMPONENT_SPM_MAILBOX)
/* Disable global interrupts */
__disable_irq();
#endif

/* Initialize shared resource manager */
cy_srm_initialize();

/* Initialize system and clocks. */
/* Placed here as it must be done after proper LIBC initialization. */
SystemInit();

#if defined(COMPONENT_SPM_MAILBOX)
mailbox_init();
#endif

/* Set up the device based on configurator selections */
init_cycfg_all();

/* Enable global interrupts */
__enable_irq();
}



/*******************************************************************************
* Function Name: Cy_SystemInit
****************************************************************************//**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,12 @@
* limitations under the License.
*******************************************************************************/

#include <stdint.h>
#include <stdbool.h>
#include "cy_device.h"
#include "device.h"
#include "system_psoc6.h"
#include "cy_device.h"
#include "cy_device_headers.h"
#include "psoc6_utils.h"
#include "cy_syslib.h"
#include "cy_wdt.h"
#include "cycfg.h"

#if !defined(CY_IPC_DEFAULT_CFG_DISABLE)
#include "cy_ipc_sema.h"
Expand All @@ -44,10 +40,6 @@

#endif /* !defined(CY_IPC_DEFAULT_CFG_DISABLE) */

#if defined(COMPONENT_SPM_MAILBOX)
void mailbox_init(void);
#endif


/*******************************************************************************
* SystemCoreClockUpdate()
Expand Down Expand Up @@ -165,38 +157,6 @@ uint32_t cy_delay32kMs = CY_DELAY_MS_OVERFLOW_THRESHOLD *
#define CY_SYS_CM4_VECTOR_TABLE_VALID_ADDR (0x000003FFUL)


/*******************************************************************************
* Function Name: mbed_sdk_init
****************************************************************************//**
*
* Mbed's post-memory-initialization function.
* Used here to initialize common parts of the Cypress libraries.
*
*******************************************************************************/
void mbed_sdk_init(void)
{
#if !defined(COMPONENT_SPM_MAILBOX)
/* Disable global interrupts */
__disable_irq();
#endif

/* Initialize shared resource manager */
cy_srm_initialize();

/* Initialize system and clocks. */
/* Placed here as it must be done after proper LIBC initialization. */
SystemInit();

#if defined(COMPONENT_SPM_MAILBOX)
/* Configure mailbox IPC interrupts */
mailbox_init();
#else
/* Enable global interrupts */
__enable_irq();
#endif
}


/*******************************************************************************
* Function Name: SystemInit
****************************************************************************//**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,12 @@
* limitations under the License.
*******************************************************************************/

#include <stdint.h>
#include <stdbool.h>
#include "cy_device.h"
#include "device.h"
#include "system_psoc6.h"
#include "cy_device.h"
#include "cy_device_headers.h"
#include "psoc6_utils.h"
#include "cy_syslib.h"
#include "cy_wdt.h"
#include "cycfg.h"

#if !defined(CY_IPC_DEFAULT_CFG_DISABLE)
#include "cy_ipc_sema.h"
Expand All @@ -43,10 +39,6 @@
#endif /* defined(CY_DEVICE_PSOC6ABLE2) */
#endif /* !defined(CY_IPC_DEFAULT_CFG_DISABLE) */

#if defined(COMPONENT_SPM_MAILBOX)
void mailbox_init(void);
#endif


/*******************************************************************************
* SystemCoreClockUpdate()
Expand Down Expand Up @@ -271,41 +263,6 @@ void SystemInit(void)
}


/*******************************************************************************
* Function Name: mbed_sdk_init
****************************************************************************//**
*
* Mbed's post-memory-initialization function.
* Used here to initialize common parts of the Cypress libraries.
*
*******************************************************************************/
void mbed_sdk_init(void)
{
#if !defined(COMPONENT_SPM_MAILBOX)
/* Disable global interrupts */
__disable_irq();
#endif

/* Initialize shared resource manager */
cy_srm_initialize();

/* Initialize system and clocks. */
/* Placed here as it must be done after proper LIBC initialization. */
SystemInit();

#if defined(COMPONENT_SPM_MAILBOX)
mailbox_init();
#endif

/* Set up the device based on configurator selections */
init_cycfg_all();

/* Enable global interrupts */
__enable_irq();
}



/*******************************************************************************
* Function Name: Cy_SystemInit
****************************************************************************//**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,12 @@
* limitations under the License.
*******************************************************************************/

#include <stdint.h>
#include <stdbool.h>
#include "cy_device.h"
#include "device.h"
#include "system_psoc6.h"
#include "cy_device.h"
#include "cy_device_headers.h"
#include "psoc6_utils.h"
#include "cy_syslib.h"
#include "cy_wdt.h"
#include "cycfg.h"

#if !defined(CY_IPC_DEFAULT_CFG_DISABLE)
#include "cy_ipc_sema.h"
Expand All @@ -43,10 +39,6 @@
#endif /* defined(CY_DEVICE_PSOC6ABLE2) */
#endif /* !defined(CY_IPC_DEFAULT_CFG_DISABLE) */

#if defined(COMPONENT_SPM_MAILBOX)
void mailbox_init(void);
#endif


/*******************************************************************************
* SystemCoreClockUpdate()
Expand Down Expand Up @@ -271,41 +263,6 @@ void SystemInit(void)
}


/*******************************************************************************
* Function Name: mbed_sdk_init
****************************************************************************//**
*
* Mbed's post-memory-initialization function.
* Used here to initialize common parts of the Cypress libraries.
*
*******************************************************************************/
void mbed_sdk_init(void)
{
#if !defined(COMPONENT_SPM_MAILBOX)
/* Disable global interrupts */
__disable_irq();
#endif

/* Initialize shared resource manager */
cy_srm_initialize();

/* Initialize system and clocks. */
/* Placed here as it must be done after proper LIBC initialization. */
SystemInit();

#if defined(COMPONENT_SPM_MAILBOX)
mailbox_init();
#endif

/* Set up the device based on configurator selections */
init_cycfg_all();

/* Enable global interrupts */
__enable_irq();
}



/*******************************************************************************
* Function Name: Cy_SystemInit
****************************************************************************//**
Expand Down
Loading

0 comments on commit c98f91e

Please sign in to comment.