...
For further information, refer to official web site: FreeRTOS - Real-time operating system for microcontrollers
The CM4 startup of CM4 is controlled by the kernel through the use of remoteproc driver. Implemented CM4 software implements control of each power domain when the system suspends/resumes. Includes polling wakeupkey to enter/is suspended or resume. It also includes polling wake-up key to enter or exit deep-sleep mode. , power down /up maindomain/ca55/npu/vcl power-domain or up main-domain, CA55, NPU, video codec powers, and data communication with between CA55 and CM4 via virtIO as well.
Contents
Table of Contents | ||
---|---|---|
|
...
Output log at UART6 (set at 115,200 bps by x-boot).
Support SP7350 power manager
Detect wake-up key
Maindomain/CA55/NPU/VCL Power Main-domain, CA55, NPU, video codec power down/up control
Support DDR retention
Support PMIC control
Supports Support communication with CA55 via virtlOserial virtual l/O serial port
Support CmBacktrace to tracks and debug ARM CortextCortex-M4
Support arduino Arduino hardware interface, such as spi/i2c/uart/timer/gpioSupport Cunit test of spi/i2c/uart/timer/gpio SPI, I2C, UART, timer, GPIO.
Support CUnit test of SPI, I2C, UART, timer, GPIO driver
Default tasks
By default, FreeRTOS of SP7350 platform is configured to run 6 tasks. In table below, we outline each task along with its location of source files and functionality.
Tasks | Folders or files | Descriptions |
powerdown | /application/power_manager/power_down.c | power-down control |
powerup | /application/power_manager/power_up.c | power-up control |
wakeupkey | /application/power_manager/wakeup_key.c | Detect wake-up key |
virtIOrw | /application/VirtIOSerial/vios_rw.cpp | virtual IO read/write |
tmr Svc | /system/freertos/timers.c | Freertos FreeRTOS system Timer task |
Idle | /system/freertos/tasks.c | Freertos FreeRTOS system Idle task |
Linux remote processor framework
The Linux Remote Processor Framework is a framework that allows for managing (power on, load firmware, power off) and communicating with remote processors on Linux systems. This framework is typically used in embedded or multiprocessor systems where one processor (usually the main processor) is responsible for managing and controlling the other remote processors. In addition, this framework also adds rpmsg virtio devices for remote processors that supports this kind of communication. This way, platform-specific remoteproc drivers only need to provide a few low-level handlers, and then all rpmsg drivers will then just work.
CM4 boot via CA55 cmd:
Code Block |
---|
echo start > /sys/class/remoteproc/remoteproc0/state |
...
Device-tree nodes for remoteproc driver
Code Block |
---|
remoteproc0: remoteproc@f800817c {
compatible = "sunplus,sp-rproc";
firmware = "firmware";
reg = <0 0xf800817c 0 4>, /* mbox G258.31, cpu0 to cpu2 direct reg07 */
<0 0xf8800250 0 4>,
<0 0xf80081fc 0 4>; /* mbox G259.31, cpu2 to cpu0 direct reg07 */
interrupt-parent = <&gic>;
interrupts = <GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>; /* CPU2_TO_0_DIRECT_INT7 */
resets = <&rstc RST_CM4>;
memory-region = <&rproc_0_reserved>, <&rproc0runaddr>,<&vdev0buffer>, <&vdev0vring0>, <&vdev0vring1>;
}; |
...
Supported drivers for SP7350 platform
...
Drivers
...
Folders or files
...
Features
...
ADC (SAR12B)
...
The source files of FreeRTOS are located within the "firmware/arduino_core_sunplus/" directory under the project's top directory. For the SP7350 platform, a wide array of device drivers is supported. These drivers are within the "system/drivers/sp7350_hal_driver/" directory. Below is a reference table detailing the drivers along with their corresponding feature descriptions:
Drivers | Files | Features |
ADC (SAR12B) | sp7350_hal_adc.c | read analog voltage |
Audio (I2S) | /system/drivers/sp7350_hal_driver/sp7350_hal_i2s.c | I2S read/write interface |
GPIO driver | /system/drivers/sp7350_hal_driver/sp7350_hal_gpio.c | write/read gpio level |
AHB DMA | /system/drivers/sp7350_hal_driver/sp7350_hal_dma.c | AHB DMA driver |
I2C driver | /system/drivers/sp7350_hal_driver/sp7350_hal_i2c.c | I2C read/write interface |
Mailbox | /system/drivers/sp7350_hal_driver/sp7350_hal_ipcc.c | trigger between CM4 and CA55 |
PWM | /system/drivers/sp7350_hal_driver/sp7350_hal_pwm.c | output pwm |
RTC | /system/drivers/sp7350_hal_driver/sp7350_hal_rtc.c | get rtc time and generate rtc irq |
SPI | /system/drivers/sp7350_hal_driver/sp7350_hal_spi.c | SPI read/write interface |
Timer | /system/drivers/sp7350_hal_driver/sp7350_hal_tim.c | get/set timer. generate timer irq |
UART | /system/drivers/sp7350_hal_driver/sp7350_hal_uart.c | UART read/write interface |
Watchdog | /system/drivers/sp7350_hal_driver/sp7350_hal_wdg.c | watchdog interface |
...
The source files of FreeRTOS are organized within the "firmware/arduino_core_sunplus/" directory at the top level of the projectproject's top directory. Below is a breakdown of the main subdirectories:
Folders | Descriptions |
cores/arduino | Contains the code for arduino Arduino only |
libraries/ | Contains the thirdparty Source third party source code and syscall‘syscall.cc’ |
application/power_manager/ | Contains power manager codes |
application/VirtIOSerial/ | Contains VirtIO Serial read/write codes |
bin/ | Output folder |
system/drivers | Contains CMIS files for CM4 and SP7350 drivers |
system/freertos | Contains Freertos FreeRTOS kernel files |
system/Middlewares | Contains Open-amp driver(VirtIO/Remoteproc)driver (VirtIO/Remoteproc) |
system/sp7350 | Contains many constant definitions |
variants/sp7350_evb/ | Contains ldscript and Config config file |
Example files
CUnit is a C unit testing framework for unit testing C programs. It provides a set of libraries and macros for writing and executing test cases and reporting test results. CUnit tests include examples using the sp7350 SP7350 peripheral interface driver. Includes examples for other drivers such as spi/i2c/uart/gpio/pwm. the path isSPI, I2C, UART, GPIO and PWM. The path is:
/application/Cunit_test
. set
Set CUNIT ?=1
in Makefile to build image. the The code will run from Cuint_main.cpp
...