|
| 1 | +# PSoC 6 Cortex M0+ Crypto server prebuilt image (CM0P_CRYPTO) |
| 2 | + |
| 3 | +### Overview |
| 4 | +Crypto server prebuilt application image is executed on the Cortex M0+ core of the PSoC 6 dual-core MCU. |
| 5 | +The image is provided as C array ready to be compiled as part of the Cortex M4 application. |
| 6 | +The Cortex M0+ application code is placed to internal flash by the Cortex M4 linker script. |
| 7 | + |
| 8 | +The Crypto server image executes the following steps: |
| 9 | +- configures IPC channel for data exchange between client and server applications; |
| 10 | +- configures three interrupts: an IPC notify interrupt, an IPC release interrupt, and an interrupt for error handling. |
| 11 | +- starts CM4 core at CY_CORTEX_M4_APPL_ADDR=0x10008000 |
| 12 | +- goes to the infinite loop that processes the crypto server events and puts the CM0+ core into Deep Sleep. |
| 13 | + |
| 14 | +### Usage |
| 15 | +To use this image, update the FLASH_CM0P_SIZE value in the linker script for CM4: |
| 16 | +``` |
| 17 | +Example for the GCC compiler: |
| 18 | +... |
| 19 | +/* The size and start addresses of the Cortex-M0+ application image */ |
| 20 | +FLASH_CM0P_SIZE = 0x8000; |
| 21 | +... |
| 22 | +``` |
| 23 | +``` |
| 24 | +Example for the IAR compiler: |
| 25 | +... |
| 26 | +/* The size and start addresses of the Cortex-M0+ application image */ |
| 27 | +define symbol FLASH_CM0P_SIZE = 0x8000; |
| 28 | +... |
| 29 | +``` |
| 30 | +``` |
| 31 | +Example for ARMC6 compiler: |
| 32 | +... |
| 33 | +/* The size and start addresses of the Cortex-M0+ application image */ |
| 34 | +#define FLASH_CM0P_SIZE 0x8000 |
| 35 | +... |
| 36 | +``` |
| 37 | + |
| 38 | +To use this image in the custom BSP, adjust the BSP target makefile to |
| 39 | +add the COMPONENT_CM0P_CRYPTO directory to the list of components |
| 40 | +discovered by ModusToolbox build system: |
| 41 | + |
| 42 | +``` |
| 43 | +COMPONENTS+=CM0P_CRYPTO |
| 44 | +``` |
| 45 | + |
| 46 | +Make sure there is a single CM0P_* component included in the COMPONENTS list |
| 47 | +(it might be needed to remove CM0P_SLEEP from the list of standard BSP components). |
| 48 | + |
| 49 | + |
| 50 | +### Crypto client configuration |
| 51 | + |
| 52 | +Example configuration of the crypto client for the Cortex-M4 core |
| 53 | +compatible with the prebuilt crypto server CM0+ application: |
| 54 | + |
| 55 | +``` |
| 56 | +#define MY_CHAN_CRYPTO (uint32_t)(3u) /* IPC data channel for the Crypto */ |
| 57 | +#define MY_INTR_CRYPTO_SRV (uint32_t)(1u) /* IPC interrupt structure for the Crypto server */ |
| 58 | +#define MY_INTR_CRYPTO_CLI (uint32_t)(2u) /* IPC interrupt structure for the Crypto client */ |
| 59 | +#define MY_INTR_CRYPTO_SRV_MUX (IRQn_Type)(2u) /* CM0+ IPC interrupt mux number the Crypto server */ |
| 60 | +#define MY_INTR_CRYPTO_CLI_MUX (IRQn_Type)(3u) /* CM0+ IPC interrupt mux number the Crypto client */ |
| 61 | +#define MY_INTR_CRYPTO_ERR_MUX (IRQn_Type)(4u) /* CM0+ ERROR interrupt mux number the Crypto server */ |
| 62 | +
|
| 63 | +const cy_stc_crypto_config_t myCryptoConfig = |
| 64 | +{ |
| 65 | + /* .ipcChannel */ MY_CHAN_CRYPTO, |
| 66 | + /* .acquireNotifierChannel */ MY_INTR_CRYPTO_SRV, |
| 67 | + /* .releaseNotifierChannel */ MY_INTR_CRYPTO_CLI, |
| 68 | + /* .releaseNotifierConfig */ { |
| 69 | + /* .cm0pSrc */ cpuss_interrupts_ipc_2_IRQn, /* depends on selected releaseNotifierChannel value */ |
| 70 | + /* .intrPriority */ 2u, |
| 71 | + }, |
| 72 | + /* .userCompleteCallback */ NULL, |
| 73 | + /* .userGetDataHandler */ NULL, |
| 74 | + /* .userErrorHandler */ NULL, |
| 75 | + /* .acquireNotifierConfig */ { |
| 76 | + /* .cm0pSrc */ cpuss_interrupts_ipc_1_IRQn, /* depends on selected acquireNotifierChannel value */ |
| 77 | + /* .intrPriority */ 2u, |
| 78 | + }, |
| 79 | + /* .cryptoErrorIntrConfig */ { |
| 80 | + /* .cm0pSrc */ cpuss_interrupt_crypto_IRQn, |
| 81 | + /* .intrPriority */ 2u, |
| 82 | + } |
| 83 | +}; |
| 84 | +``` |
| 85 | + |
| 86 | +Refer to the [PDL API Reference Guide][pdl_crypto] for more information related to the PSoC 6 Crypto client configuration. |
| 87 | + |
| 88 | +--- |
| 89 | +Copyright (c) Cypress Semiconductor Corporation, 2019. |
| 90 | + |
| 91 | +[pdl_crypto]: https://cypresssemiconductorco.github.io/psoc6pdl/pdl_api_reference_manual/html/group__group__crypto__cli__srv.html |
0 commit comments