AM62x MCU+ SDK  10.01.00
Spinlock Example

Introduction

The Spinlock module provides hardware assistance for synchronizing the processes running on multiple processors in the device. The following example shows the working of spinlock in synchronizing multiple cores.

In this example 2 cores work simultaneously. Synchronization is achieved with the help of spinlock, where the core is only active when it has acquired the spinlock, while the other core waits till the lock if free.

Supported Combinations

Parameter Value
CPU + OS a53ss0-0 nortos
r5fss0-0 freertos
Toolchain arm.gnu.aarch64-none
ti-arm-clang
Boards am62x-sk, am62x-sk-lp, am62x-sip-sk
Example folder examples/drivers/spinlock/spinlock_example/

Steps to Run the Example

Note
This is a system or multi-core project, so refer to system project build instructions for CCS project or makefiles when building the example.
  • When using CCS projects to build, import the system CCS project and build it using the CCS project menu (see Using SDK with CCS Projects). This will build all the dependant CPU projects as well
  • When using makefiles to build, build the system makefile using make command (see Using SDK with Makefiles). This will build all the dependant CPU makefiles as well.
  • Launch a CCS debug session and run the executables, see CCS Launch, Load and Run
  • This is a multi-core example. Hence the executables should be loaded and run for all the above mentioned cores
Attention
As the wake-up R5 is the device manager, it needs to be started by the SBL. So it can not be loaded through CCS. It should be flashed and booted through SBL.

Sample Output

Shown below is a sample output when the application is run,

hello core 1
hello core 0
hello core 1
hello core 0
hello core 1
hello core 0
hello core 1
hello core 0
hello core 1
hello core 0
All tests have passed!!