Skip to content

Commit dea40b6

Browse files
Karl Zhanggalak
Karl Zhang
authored andcommitted
Musca B1: MHU: IPM MHU dual core on V2M Musca B1
Add support for ipm_mhu_dual_core sample on Musca B1. Signed-off-by: Karl Zhang <[email protected]>
1 parent 26b1e07 commit dea40b6

File tree

4 files changed

+85
-1
lines changed

4 files changed

+85
-1
lines changed

samples/subsys/ipc/ipm_mhu_dual_core/README.rst

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ steps are:
1818
Building and Running
1919
********************
2020

21+
On Musca A1
22+
-----------
23+
2124
This project outputs 'IPM MHU sample on musca_a' to the console.
2225
It can be built and executed on Musca A1 CPU 0 as follows:
2326

@@ -36,6 +39,40 @@ It can be built and executed on Musca A1 CPU 1 as follows:
3639
:goals: run
3740
:compact:
3841

42+
On Musca B1
43+
-----------
44+
45+
This project outputs 'IPM MHU sample on musca_b1' to the console.
46+
It can be built and executed on Musca B1 CPU 0 as follows:
47+
48+
.. zephyr-app-commands::
49+
:zephyr-app: samples/subsys/ipc/ipm_mhu_dual_core
50+
:board: v2m_musca_b1
51+
:goals: run
52+
:compact:
53+
54+
This project outputs 'IPM MHU sample on v2m_musca_b1_nonsecure' to the console.
55+
It can be built and executed on Musca B1 CPU 1 as follows:
56+
57+
.. zephyr-app-commands::
58+
:zephyr-app: samples/subsys/ipc/ipm_mhu_dual_core
59+
:board: v2m_musca_b1_nonsecure
60+
:goals: run
61+
:compact:
62+
63+
Combine images for Musca
64+
========================
65+
66+
A third-party tool (srecord) is used to generate the Intel formatted hex image.
67+
For more information refer to the `Srecord Manual`_.
68+
69+
.. code-block:: bash
70+
71+
srec_cat zephyr.bin -Binary -offset $IMAGE_OFFSET zephyr_nonsecure.bin -Binary -offset $IMAGE_NS_OFFSET -o dual_core_zephyr.hex -Intel
72+
73+
# This command is an example for Musca B1
74+
srec_cat zephyr.bin -Binary -offset 0xA000000 zephyr_nonsecure.bin -Binary -offset 0xA060400 -o dual_core_zephyr.hex -Intel
75+
3976
Open a serial terminal (minicom, putty, etc.) and connect the board with the
4077
following settings:
4178

@@ -61,3 +98,7 @@ Sample Output
6198
MHU ISR on CPU 0
6299
MHU ISR on CPU 1
63100
MHU Test Done.
101+
102+
103+
.. _Srecord Manual:
104+
http://srecord.sourceforge.net/man/man1/srec_cat.html

samples/subsys/ipc/ipm_mhu_dual_core/sample.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ sample:
55
tests:
66
test:
77
tags: ipm
8-
platform_whitelist: v2m_musca v2m_musca_nonsecure
8+
platform_whitelist: v2m_musca v2m_musca_nonsecure v2m_musca_b1 v2m_musca_b1_nonsecure

soc/arm/arm/musca_b1/soc.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,45 @@
88
#include <init.h>
99
#include <soc.h>
1010

11+
/* (Secure System Control) Base Address */
12+
#define SSE_200_SYSTEM_CTRL_S_BASE (0x50021000UL)
13+
#define SSE_200_SYSTEM_CTRL_INITSVTOR1 (SSE_200_SYSTEM_CTRL_S_BASE + 0x114)
14+
#define SSE_200_SYSTEM_CTRL_CPU_WAIT (SSE_200_SYSTEM_CTRL_S_BASE + 0x118)
15+
#define SSE_200_CPU_ID_UNIT_BASE (0x5001F000UL)
16+
17+
#define NON_SECURE_FLASH_ADDRESS (0x60000)
18+
#define NON_SECURE_FLASH_OFFSET (0x10000000)
19+
#define BL2_HEADER_SIZE (0x400)
20+
21+
/**
22+
* @brief Wake up CPU 1 from another CPU, this is plaform specific.
23+
*
24+
*/
25+
void wakeup_cpu1(void)
26+
{
27+
/* Set the Initial Secure Reset Vector Register for CPU 1 */
28+
*(u32_t *)(SSE_200_SYSTEM_CTRL_INITSVTOR1) =
29+
CONFIG_FLASH_BASE_ADDRESS +
30+
BL2_HEADER_SIZE +
31+
NON_SECURE_FLASH_ADDRESS -
32+
NON_SECURE_FLASH_OFFSET;
33+
34+
/* Set the CPU Boot wait control after reset */
35+
*(u32_t *)(SSE_200_SYSTEM_CTRL_CPU_WAIT) = 0;
36+
}
37+
38+
/**
39+
* @brief Get the current CPU ID, this is plaform specific.
40+
*
41+
* @return Current CPU ID
42+
*/
43+
u32_t sse_200_platform_get_cpu_id(void)
44+
{
45+
volatile u32_t *p_cpu_id = (volatile u32_t *)SSE_200_CPU_ID_UNIT_BASE;
46+
47+
return (u32_t)*p_cpu_id;
48+
}
49+
1150
/**
1251
* @brief Perform basic hardware initialization at boot.
1352
*

soc/arm/arm/musca_b1/soc.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@
1313
#include <sys/util.h>
1414
#endif
1515

16+
extern void wakeup_cpu1(void);
17+
18+
extern u32_t sse_200_platform_get_cpu_id(void);
19+
1620
#endif /* _SOC_H_ */

0 commit comments

Comments
 (0)