├── .github ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── SECURITY.md └── pull_request_template.md ├── C2000_F2838x_C28x_CCS ├── CCS │ ├── freertos_ex1_c28x_port_val.projectspec │ ├── freertos_ex2_c28x_led_blinky.projectspec │ ├── freertos_ex2_led_blinky.projectspec │ ├── freertos_ex3_c28x_dual_blinky.projectspec │ └── freertos_ex4_c28x_interrupt_latency.projectspec ├── FreeRTOSConfig.h ├── README.md ├── freertos_config │ ├── FreeRTOSConfig_ex1_portval.h │ ├── FreeRTOSConfig_ex2_led_blinky.h │ ├── FreeRTOSConfig_ex3_dual_blinky.h │ └── FreeRTOSConfig_ex4_interrupt_latency.h ├── freertos_ex1_c28x_port_val.c ├── freertos_ex2_c28x_led_blinky.c ├── freertos_ex2_led_blinky.c ├── freertos_ex3_c28x_dual_blinky_cpu1.c ├── freertos_ex3_c28x_dual_blinky_cpu2.c ├── freertos_ex4_c28x_interrupt_latency.c ├── linker_cmd │ ├── 2838x_FREERTOS_FLASH_lnk_cpu2.cmd │ ├── 2838x_FreeRTOS_FLASH_lnk_cpu1.cmd │ ├── 2838x_FreeRTOS_RAM_lnk_cpu1.cmd │ └── 2838x_FreeRTOS_RAM_lnk_cpu2.cmd ├── port_validation │ ├── 2838x_FreeRTOS_FLASH_lnk_cpu1.cmd │ ├── FreeRTOSConfig.h │ ├── README.md │ ├── RegTests.c │ ├── RegTests.h │ ├── TestRunner.c │ └── TestRunner.h └── print_support │ ├── printf-stdarg.c │ ├── uart_drv.c │ └── uart_drv.h ├── CORTEX_A9_Zynq7000_GCC ├── .gitignore ├── FreeRTOSDemo │ ├── CMakeLists.txt │ ├── Demo │ │ ├── FreeRTOSConfig.h │ │ ├── IntQueueTimer.c │ │ ├── IntQueueTimer.h │ │ ├── RegTest.S │ │ ├── RegTests.c │ │ ├── RegTests.h │ │ ├── TestRunner.c │ │ └── TestRunner.h │ ├── Xilinx.spec │ ├── lscript.ld │ ├── main.c │ ├── platform.c │ ├── platform.h │ └── platform_config.h ├── LICENSE └── README.md ├── CORTEX_M0+_RP2040 ├── .gitignore ├── CMakeLists.txt ├── OnEitherCore │ ├── CMakeLists.txt │ ├── FreeRTOSConfig.h │ ├── FreeRTOS_Kernel_import.cmake │ ├── README.md │ ├── main.c │ └── pico_sdk_import.cmake ├── README.md ├── Standard │ ├── CMakeLists.txt │ ├── FreeRTOSConfig.h │ ├── FreeRTOS_Kernel_import.cmake │ ├── IntQueueTimer.c │ ├── IntQueueTimer.h │ ├── RegTest.s │ ├── main.c │ ├── main.h │ ├── main_blinky.c │ ├── main_full.c │ └── pico_sdk_import.cmake ├── Standard_smp │ ├── CMakeLists.txt │ ├── FreeRTOSConfig.h │ ├── FreeRTOS_Kernel_import.cmake │ ├── IntQueueTimer.c │ ├── IntQueueTimer.h │ ├── RegTest.s │ ├── main.c │ ├── main.h │ ├── main_blinky.c │ ├── main_full.c │ └── pico_sdk_import.cmake ├── UsingCMSIS │ ├── CMakeLists.txt │ ├── FreeRTOSConfig.h │ ├── FreeRTOS_Kernel_import.cmake │ ├── README.md │ ├── main.c │ └── pico_sdk_import.cmake └── pico_sdk_import.cmake ├── CORTEX_M0_FT32F072_KEIL ├── FreeRTOS_Demo.uvprojx ├── Source │ ├── Driver │ │ ├── inc │ │ │ ├── Peripheral.h │ │ │ └── board.h │ │ └── src │ │ │ ├── Peripheral.c │ │ │ └── board.c │ ├── Libraries │ │ ├── CMSIS │ │ │ └── FT32F0xx │ │ │ │ ├── Include │ │ │ │ ├── core_cm0.h │ │ │ │ ├── core_cm0plus.h │ │ │ │ ├── core_cmFunc.h │ │ │ │ ├── core_cmInstr.h │ │ │ │ ├── ft32f030x6.h │ │ │ │ ├── ft32f030x8.h │ │ │ │ ├── ft32f072x8.h │ │ │ │ ├── ft32f0xx.h │ │ │ │ └── system_ft32f0xx.h │ │ │ │ └── source │ │ │ │ ├── arm │ │ │ │ ├── startup_ft32f030x6.s │ │ │ │ ├── startup_ft32f030x8.s │ │ │ │ └── startup_ft32f072xb.s │ │ │ │ └── system_ft32f0xx.c │ │ └── FT32F0xx_Driver │ │ │ ├── Inc │ │ │ ├── ft32f0xx_adc.h │ │ │ ├── ft32f0xx_comp.h │ │ │ ├── ft32f0xx_crc.h │ │ │ ├── ft32f0xx_crs.h │ │ │ ├── ft32f0xx_dac.h │ │ │ ├── ft32f0xx_debug.h │ │ │ ├── ft32f0xx_dma.h │ │ │ ├── ft32f0xx_exti.h │ │ │ ├── ft32f0xx_flash.h │ │ │ ├── ft32f0xx_gpio.h │ │ │ ├── ft32f0xx_i2c.h │ │ │ ├── ft32f0xx_iwdg.h │ │ │ ├── ft32f0xx_misc.h │ │ │ ├── ft32f0xx_opa.h │ │ │ ├── ft32f0xx_pwr.h │ │ │ ├── ft32f0xx_rcc.h │ │ │ ├── ft32f0xx_rtc.h │ │ │ ├── ft32f0xx_spi.h │ │ │ ├── ft32f0xx_syscfg.h │ │ │ ├── ft32f0xx_tim.h │ │ │ ├── ft32f0xx_usart.h │ │ │ └── ft32f0xx_wwdg.h │ │ │ └── Src │ │ │ ├── ft32f0xx_adc.c │ │ │ ├── ft32f0xx_comp.c │ │ │ ├── ft32f0xx_crc.c │ │ │ ├── ft32f0xx_crs.c │ │ │ ├── ft32f0xx_dac.c │ │ │ ├── ft32f0xx_debug.c │ │ │ ├── ft32f0xx_dma.c │ │ │ ├── ft32f0xx_exti.c │ │ │ ├── ft32f0xx_flash.c │ │ │ ├── ft32f0xx_gpio.c │ │ │ ├── ft32f0xx_i2c.c │ │ │ ├── ft32f0xx_iwdg.c │ │ │ ├── ft32f0xx_misc.c │ │ │ ├── ft32f0xx_opa.c │ │ │ ├── ft32f0xx_pwr.c │ │ │ ├── ft32f0xx_rcc.c │ │ │ ├── ft32f0xx_rtc.c │ │ │ ├── ft32f0xx_spi.c │ │ │ ├── ft32f0xx_syscfg.c │ │ │ ├── ft32f0xx_tim.c │ │ │ ├── ft32f0xx_usart.c │ │ │ └── ft32f0xx_wwdg.c │ ├── Tasks │ │ ├── inc │ │ │ ├── HighProTask.h │ │ │ ├── IdleTask.h │ │ │ ├── InitTask.h │ │ │ ├── LowProTask.h │ │ │ └── TaskManager.h │ │ └── src │ │ │ ├── HighProTask.c │ │ │ ├── IdleTask.c │ │ │ ├── InitTask.c │ │ │ ├── LowProTask.c │ │ │ └── TaskManager.c │ └── User │ │ ├── inc │ │ ├── FreeRTOSConfig.h │ │ ├── appconfig.h │ │ ├── config.h │ │ ├── ft32f030x8_conf.h │ │ ├── ft32f0xx_conf.h │ │ ├── ft32f0xx_it.h │ │ └── main.h │ │ └── src │ │ ├── ft32f0xx_it.c │ │ └── main.c └── ft32f0xx_conf.h ├── CORTEX_M4F_TM4C123G_Launchpad_GCC ├── Blinky_Demo │ ├── FreeRTOSConfig.h │ ├── TM4C123GH6PM.ld │ ├── main.c │ ├── makefile │ └── startup_gcc.c ├── Full_Demo │ ├── FreeRTOSConfig.h │ ├── Full_Template │ │ ├── IntQueueTimer.c │ │ ├── IntQueueTimer.h │ │ ├── RegTests.c │ │ ├── RegTests.h │ │ ├── TestRunner.c │ │ └── TestRunner.h │ ├── Makefile_b │ ├── TM4C123GH6PM.ld │ ├── main.back │ ├── main.c │ ├── makefile │ └── startup_gcc.c ├── README.md ├── driverlib │ ├── adc.c │ ├── adc.h │ ├── aes.c │ ├── aes.h │ ├── can.c │ ├── can.h │ ├── comp.c │ ├── comp.h │ ├── cpu.c │ ├── cpu.h │ ├── crc.c │ ├── crc.h │ ├── debug.h │ ├── des.c │ ├── des.h │ ├── driverlib.h │ ├── eeprom.c │ ├── eeprom.h │ ├── emac.c │ ├── emac.h │ ├── epi.c │ ├── epi.h │ ├── flash.c │ ├── flash.h │ ├── fpu.c │ ├── fpu.h │ ├── gpio.c │ ├── gpio.h │ ├── hibernate.c │ ├── hibernate.h │ ├── i2c.c │ ├── i2c.h │ ├── inc │ │ ├── hw_adc.h │ │ ├── hw_aes.h │ │ ├── hw_can.h │ │ ├── hw_ccm.h │ │ ├── hw_comp.h │ │ ├── hw_des.h │ │ ├── hw_eeprom.h │ │ ├── hw_emac.h │ │ ├── hw_epi.h │ │ ├── hw_fan.h │ │ ├── hw_flash.h │ │ ├── hw_gpio.h │ │ ├── hw_hibernate.h │ │ ├── hw_i2c.h │ │ ├── hw_ints.h │ │ ├── hw_lcd.h │ │ ├── hw_memmap.h │ │ ├── hw_nvic.h │ │ ├── hw_onewire.h │ │ ├── hw_pwm.h │ │ ├── hw_qei.h │ │ ├── hw_shamd5.h │ │ ├── hw_ssi.h │ │ ├── hw_sysctl.h │ │ ├── hw_sysexc.h │ │ ├── hw_timer.h │ │ ├── hw_types.h │ │ ├── hw_uart.h │ │ ├── hw_udma.h │ │ ├── hw_usb.h │ │ └── hw_watchdog.h │ ├── interrupt.c │ ├── interrupt.h │ ├── lcd.c │ ├── lcd.h │ ├── mpu.c │ ├── mpu.h │ ├── onewire.c │ ├── onewire.h │ ├── pin_map.h │ ├── pwm.c │ ├── pwm.h │ ├── qei.c │ ├── qei.h │ ├── rom.h │ ├── rom_map.h │ ├── rtos_bindings.h │ ├── shamd5.c │ ├── shamd5.h │ ├── ssi.c │ ├── ssi.h │ ├── sw_crc.c │ ├── sw_crc.h │ ├── sysctl.c │ ├── sysctl.h │ ├── sysexc.c │ ├── sysexc.h │ ├── systick.c │ ├── systick.h │ ├── timer.c │ ├── timer.h │ ├── uart.c │ ├── uart.h │ ├── udma.c │ ├── udma.h │ ├── usb.c │ ├── usb.h │ ├── watchdog.c │ └── watchdog.h ├── makedefs └── utils │ ├── uartstdio.c │ └── uartstdio.h ├── LICENSE ├── README.md ├── RH850_F1KM_S4_CCRH ├── .cproject ├── .gitignore ├── .project ├── .settings │ ├── CoverageSetting.xml │ ├── DebugVirtualConsoleSetting.xml │ ├── Dependency_Scan_Preferences.prefs │ ├── IORegisterSetting.xml │ ├── com.renesas.hardwaredebug.rh850.e1.PerfAnalysisSettings.xml │ ├── com.renesas.tools.misrac.prefs │ ├── e2studio_project.prefs │ ├── org.eclipse.cdt.core.prefs │ ├── org.eclipse.core.resources.prefs │ ├── org.eclipse.ltk.core.refactoring.prefs │ └── renesasPGModel.xml ├── README.md ├── RH850_F1KM_RTOS HardwareDebug.launch ├── RH850_F1KM_RTOS.rcpc ├── bsp │ ├── bsp_clock │ │ ├── bsp_clock.c │ │ └── bsp_clock.h │ ├── bsp_irq │ │ ├── bsp_irq.c │ │ ├── bsp_irq.h │ │ ├── vector_data.c │ │ └── vector_data.h │ └── common │ │ ├── boot.asm │ │ ├── boot.asm.bak │ │ ├── bsp_common.h │ │ ├── bsp_compiler_support.h │ │ ├── bsp_macro.h │ │ ├── cstart.asm │ │ └── iodefine.h ├── freertos │ └── FreeRTOSConfig.h └── src │ ├── IntQueueTimer.c │ ├── IntQueueTimer.h │ ├── README.md │ ├── RegTest.s │ ├── RegTests.h │ ├── RegTestsTask.c │ ├── TestRunner.c │ ├── TestRunner.h │ └── main.c ├── RH850_F1Kx_CCRH ├── Image │ └── Linker.png ├── SMP_MultiCore │ ├── .cproject │ ├── .gitignore │ ├── .project │ ├── .settings │ │ ├── CoverageSetting.xml │ │ ├── DebugVirtualConsoleSetting.xml │ │ ├── Dependency_Scan_Preferences.prefs │ │ ├── IORegisterSetting.xml │ │ ├── com.renesas.hardwaredebug.rh850.e1.PerfAnalysisSettings.xml │ │ ├── com.renesas.tools.misrac.prefs │ │ ├── e2studio_project.prefs │ │ ├── org.eclipse.cdt.core.prefs │ │ ├── org.eclipse.core.resources.prefs │ │ ├── org.eclipse.ltk.core.refactoring.prefs │ │ └── renesasPGModel.xml │ ├── README.md │ ├── RH850_F1K_MULTI.rcpc │ ├── bsp │ │ ├── bsp_clock │ │ │ ├── bsp_clock.c │ │ │ └── bsp_clock.h │ │ ├── bsp_irq │ │ │ ├── bsp_irq.c │ │ │ ├── bsp_irq.h │ │ │ ├── vector_data.c │ │ │ └── vector_data.h │ │ └── common │ │ │ ├── bsp_common.h │ │ │ ├── bsp_compiler_support.h │ │ │ ├── bsp_macro.h │ │ │ ├── coldreset.asm │ │ │ ├── iodefine.h │ │ │ ├── startup_PE1.asm │ │ │ └── startup_PEn.asm │ ├── freertos │ │ ├── FreeRTOSConfig.h │ │ └── FreeRTOSConfigMultiCore.h │ └── src │ │ ├── README.md │ │ ├── RegTest.s │ │ ├── RegTests.h │ │ ├── RegTestsTask.c │ │ ├── TestRunner.c │ │ ├── TestRunner.h │ │ ├── main.c │ │ ├── main.h │ │ └── main_blinky.c └── SMP_SingleCore │ ├── .cproject │ ├── .gitignore │ ├── .project │ ├── .settings │ ├── CoverageSetting.xml │ ├── DebugVirtualConsoleSetting.xml │ ├── Dependency_Scan_Preferences.prefs │ ├── IORegisterSetting.xml │ ├── com.renesas.hardwaredebug.rh850.e1.PerfAnalysisSettings.xml │ ├── com.renesas.tools.misrac.prefs │ ├── e2studio_project.prefs │ ├── org.eclipse.cdt.core.prefs │ ├── org.eclipse.core.resources.prefs │ ├── org.eclipse.ltk.core.refactoring.prefs │ └── renesasPGModel.xml │ ├── README.md │ ├── bsp │ ├── bsp_clock │ │ ├── bsp_clock.c │ │ └── bsp_clock.h │ ├── bsp_irq │ │ ├── bsp_irq.c │ │ ├── bsp_irq.h │ │ ├── vector_data.c │ │ └── vector_data.h │ └── common │ │ ├── bsp_common.h │ │ ├── bsp_compiler_support.h │ │ ├── bsp_macro.h │ │ ├── coldreset.asm │ │ ├── iodefine.h │ │ ├── startup_PE1.asm │ │ └── startup_PEn.asm │ ├── freertos │ ├── FreeRTOSConfig.h │ ├── FreeRTOSConfigSingleCore.h │ └── note.txt │ └── src │ ├── README.md │ ├── RegTest.s │ ├── RegTests.h │ ├── RegTestsTask.c │ ├── TestRunner.c │ ├── TestRunner.h │ └── main.c ├── RISC-V_RV32_THEAD_SMART_CDS ├── VERSION ├── board │ └── smartl_e906_evb │ │ ├── board_init.c │ │ ├── gcc_csky.ld │ │ └── include │ │ ├── pin.h │ │ ├── test_driver_config.h │ │ └── test_kernel_config.h ├── csi_core │ └── include │ │ ├── core_rv32.h │ │ ├── csi_core.h │ │ └── csi_rv32_gcc.h ├── csi_driver │ ├── include │ │ ├── drv_aes.h │ │ ├── drv_common.h │ │ ├── drv_crc.h │ │ ├── drv_dmac.h │ │ ├── drv_eflash.h │ │ ├── drv_errno.h │ │ ├── drv_gpio.h │ │ ├── drv_i2s.h │ │ ├── drv_iic.h │ │ ├── drv_intc.h │ │ ├── drv_irq.h │ │ ├── drv_pmu.h │ │ ├── drv_pwm.h │ │ ├── drv_rsa.h │ │ ├── drv_rtc.h │ │ ├── drv_sha.h │ │ ├── drv_spi.h │ │ ├── drv_spiflash.h │ │ ├── drv_timer.h │ │ ├── drv_trng.h │ │ ├── drv_usart.h │ │ └── drv_wdt.h │ └── smartl_rv32 │ │ ├── ck_irq.c │ │ ├── ck_usart.c │ │ ├── devices.c │ │ ├── dw_gpio.c │ │ ├── dw_timer.c │ │ ├── include │ │ ├── ck_usart.h │ │ ├── dw_gpio.h │ │ ├── dw_timer.h │ │ ├── pin_name.h │ │ ├── pinmux.h │ │ ├── soc.h │ │ └── sys_freq.h │ │ ├── isr.c │ │ ├── lib.c │ │ ├── novic_irq_tbl.c │ │ ├── pinmux.c │ │ ├── startup.S │ │ ├── sys_freq.c │ │ ├── system.c │ │ ├── trap_c.c │ │ └── vectors.S ├── csi_kernel │ ├── freertosv10.3.1 │ │ ├── adapter │ │ │ └── csi_freertos.c │ │ └── include │ │ │ └── FreeRTOSConfig.h │ └── include │ │ └── csi_kernel.h ├── libs │ ├── include │ │ ├── errno.h │ │ ├── mm.h │ │ ├── mm_queue.h │ │ ├── ringbuffer │ │ │ └── ringbuffer.h │ │ ├── sys │ │ │ └── _stdint.h │ │ ├── syslog.h │ │ ├── time.h │ │ └── umm_heap.h │ ├── libc │ │ ├── _init.c │ │ ├── clock_gettime.c │ │ ├── malloc.c │ │ ├── minilibc_port.c │ │ └── printf.c │ ├── mm │ │ ├── dq_addlast.c │ │ ├── dq_rem.c │ │ ├── lib_mallinfo.c │ │ ├── mm_addfreechunk.c │ │ ├── mm_free.c │ │ ├── mm_initialize.c │ │ ├── mm_leak.c │ │ ├── mm_mallinfo.c │ │ ├── mm_malloc.c │ │ └── mm_size2ndx.c │ ├── ringbuffer │ │ └── ringbuffer.c │ └── syslog │ │ └── syslog.c ├── projects │ ├── event │ │ ├── event_test.c │ │ ├── freertos │ │ │ ├── CDK │ │ │ │ └── smartl_e906fd-freertos-event.cdkproj │ │ │ ├── CDS │ │ │ │ ├── .cproject │ │ │ │ └── .project │ │ │ ├── Makefile │ │ │ ├── configs │ │ │ │ └── csi_config.h │ │ │ └── sub.mk │ │ ├── main.c │ │ └── test_kernel.h │ ├── message_q │ │ ├── freertos │ │ │ ├── CDK │ │ │ │ └── smartl_e906fd-freertos-message_q.cdkproj │ │ │ ├── CDS │ │ │ │ ├── .cproject │ │ │ │ └── .project │ │ │ ├── Makefile │ │ │ ├── configs │ │ │ │ └── csi_config.h │ │ │ └── sub.mk │ │ ├── main.c │ │ ├── message_q_test.c │ │ └── test_kernel.h │ ├── mutex │ │ ├── freertos │ │ │ ├── CDK │ │ │ │ └── smartl_e906fd-freertos-mutex.cdkproj │ │ │ ├── CDS │ │ │ │ ├── .cproject │ │ │ │ └── .project │ │ │ ├── Makefile │ │ │ ├── configs │ │ │ │ └── csi_config.h │ │ │ └── sub.mk │ │ ├── main.c │ │ ├── mutex_test.c │ │ └── test_kernel.h │ ├── sem │ │ ├── freertos │ │ │ ├── CDK │ │ │ │ └── smartl_e906fd-freertos-sem.cdkproj │ │ │ ├── CDS │ │ │ │ ├── .cproject │ │ │ │ └── .project │ │ │ ├── Makefile │ │ │ ├── configs │ │ │ │ └── csi_config.h │ │ │ └── sub.mk │ │ ├── main.c │ │ ├── sem_test.c │ │ └── test_kernel.h │ ├── task │ │ ├── freertos │ │ │ ├── CDK │ │ │ │ └── smartl_e906fd-freertos-task.cdkproj │ │ │ ├── CDS │ │ │ │ ├── .cproject │ │ │ │ └── .project │ │ │ ├── Makefile │ │ │ ├── configs │ │ │ │ └── csi_config.h │ │ │ └── sub.mk │ │ ├── main.c │ │ ├── task_test.c │ │ └── test_kernel.h │ ├── time │ │ ├── freertos │ │ │ ├── CDK │ │ │ │ └── smartl_e906fd-freertos-time.cdkproj │ │ │ ├── CDS │ │ │ │ ├── .cproject │ │ │ │ └── .project │ │ │ ├── Makefile │ │ │ ├── configs │ │ │ │ └── csi_config.h │ │ │ └── sub.mk │ │ ├── main.c │ │ ├── test_kernel.h │ │ └── time_test.c │ └── timer │ │ ├── freertos │ │ ├── CDK │ │ │ └── smartl_e906fd-freertos-timer.cdkproj │ │ ├── CDS │ │ │ ├── .cproject │ │ │ └── .project │ │ ├── Makefile │ │ ├── configs │ │ │ └── csi_config.h │ │ └── sub.mk │ │ ├── main.c │ │ ├── test_kernel.h │ │ └── timer_test.c └── utilities │ ├── aft_build.sh │ ├── flash.init │ ├── gdb-qemu.init │ └── gdb.init ├── Renesas-RISC-V-MCU_llvm ├── README.md └── src │ ├── Demo │ ├── Common │ │ ├── common.c │ │ ├── common.h │ │ ├── vector_table.c │ │ └── vector_table_asm.S │ ├── FreeRTOSConfig.h │ ├── IntQueueTimer.c │ ├── IntQueueTimer.h │ ├── RegTests.c │ ├── RegTests.h │ ├── TestRunner.c │ ├── TestRunner.h │ └── main.c │ ├── linker_script.ld │ └── smc_gen │ ├── Config_ICU │ ├── Config_ICU.c │ ├── Config_ICU.h │ └── Config_ICU_user.c │ ├── Config_UART0 │ ├── Config_UART0.c │ ├── Config_UART0.h │ └── Config_UART0_user.c │ ├── general │ ├── r_cg_icu.h │ ├── r_cg_interrupt_handlers.h │ ├── r_cg_inthandler.c │ ├── r_cg_macrodriver.h │ ├── r_cg_sau.h │ ├── r_cg_sau_common.c │ ├── r_cg_sau_common.h │ ├── r_cg_systeminit.c │ ├── r_cg_userdefine.h │ ├── r_cg_vect_table.c │ ├── r_smc_cgc.c │ ├── r_smc_cgc.h │ ├── r_smc_cgc_user.c │ ├── r_smc_entry.h │ ├── r_smc_interrupt.c │ └── r_smc_interrupt.h │ ├── r_bsp │ ├── board │ │ └── generic_r9a02g021 │ │ │ ├── hdwinit.c │ │ │ ├── hdwinit.h │ │ │ ├── r_bsp.h │ │ │ ├── r_bsp_config_reference.h │ │ │ ├── r_bsp_init.c │ │ │ └── r_bsp_interrupt_config_reference.h │ ├── doc │ │ └── en │ │ │ └── r01an7177ej0122-risc-v-mcu-bsp.pdf │ ├── mcu │ │ ├── all │ │ │ ├── exit.s │ │ │ ├── machine_timer_aux.s │ │ │ ├── r_bsp_common.c │ │ │ ├── r_bsp_common.h │ │ │ ├── r_bsp_common_llvm.s │ │ │ ├── r_bsp_machine_timer.c │ │ │ ├── r_bsp_machine_timer.h │ │ │ ├── r_bsp_riscv_mcu_compiler.h │ │ │ └── start.s │ │ └── r9a02g021 │ │ │ ├── mcu_clocks.c │ │ │ ├── mcu_clocks.h │ │ │ ├── mcu_info.h │ │ │ ├── mcu_mapped_interrupts.c │ │ │ ├── mcu_mapped_interrupts.h │ │ │ ├── mcu_mapped_interrupts_private.h │ │ │ ├── mcu_option_settings.c │ │ │ └── register_access │ │ │ └── llvm │ │ │ └── iodefine.h │ ├── platform.h │ └── readme.txt │ ├── r_config │ ├── r_bsp_config.h │ └── r_bsp_interrupt_config.h │ └── r_pincfg │ ├── Pin.c │ └── Pin.h ├── XCORE.AI_xClang ├── .gitignore ├── README.md ├── RTOSDemo │ ├── .cproject │ ├── .gitignore │ ├── .project │ ├── Makefile │ └── src │ │ ├── FreeRTOSConfig.h │ │ ├── IntQueueTimer │ │ ├── IntQueueTimer.c │ │ └── IntQueueTimer.h │ │ ├── XCORE-AI-EXPLORER.xn │ │ ├── config.xscope │ │ ├── main.xc │ │ ├── partest │ │ ├── mab_led_driver.xc │ │ └── partest.c │ │ ├── regtest │ │ ├── prvRegisterCheck_asm1.S │ │ ├── prvRegisterCheck_asm2.S │ │ ├── regtest.c │ │ └── regtest.h │ │ ├── test.c │ │ └── testing_main.h └── lib_rtos_support │ ├── .cproject │ ├── .project │ ├── api │ ├── rtos_cores.h │ ├── rtos_interrupt.h │ ├── rtos_irq.h │ ├── rtos_locks.h │ ├── rtos_macros.h │ ├── rtos_printf.h │ ├── rtos_support.h │ └── rtos_time.h │ ├── module_build_info │ └── src │ ├── rtos_cores.c │ ├── rtos_interrupt.c │ ├── rtos_interrupt_impl.h │ ├── rtos_irq.c │ ├── rtos_locks.c │ ├── rtos_printf.c │ └── rtos_time.c └── shakti ├── README ├── bsp ├── core │ ├── init.c │ ├── start.S │ ├── trap.S │ └── traps.c ├── drivers │ ├── clint │ │ └── clint_driver.c │ ├── i2c │ │ ├── gpio_i2c.c │ │ └── i2c_driver.c │ ├── plic │ │ └── plic_driver.c │ ├── pwm │ │ └── pwm_driver.c │ ├── qspi │ │ └── qspi_micron.c │ ├── spi │ │ ├── gpio_spi.c │ │ ├── spi_flash_w25q32.c │ │ └── spi_spansion.c │ ├── uart │ │ └── uart.c │ └── xadc │ │ └── xadc_driver.c ├── include │ ├── clint_driver.h │ ├── defines.h │ ├── gpio.h │ ├── gpio_i2c.h │ ├── gpio_spi.h │ ├── i2c.h │ ├── log.h │ ├── memory.h │ ├── pinmux.h │ ├── plic_driver.h │ ├── pwm_driver.h │ ├── qspi.h │ ├── spi.h │ ├── traps.h │ ├── uart.h │ ├── utils.h │ └── xadc_driver.h ├── libs │ ├── log.c │ ├── malloc_firstfit.c │ ├── memory.c │ ├── printf.c │ ├── sys_brk.c │ └── util.c ├── third_party │ ├── parashu │ │ ├── ftdi.cfg │ │ ├── link.ld │ │ ├── linker.c │ │ └── platform.h │ ├── pinaka │ │ ├── ftdi.cfg │ │ ├── link.ld │ │ ├── linker.c │ │ └── platform.h │ └── vajra │ │ ├── ftdi.cfg │ │ ├── link.ld │ │ ├── linker.c │ │ └── platform.h └── utils │ └── uploader │ ├── burnFlash.py │ ├── elf_to_header.c │ ├── micron │ └── deploy.c │ └── spansion │ ├── deploy.c │ └── erase.c ├── parashu ├── Makefile ├── conf │ └── FreeRTOSConfig.h └── main.c ├── pinaka ├── Makefile ├── conf │ └── FreeRTOSConfig.h └── main.c └── vajra ├── Makefile ├── conf └── FreeRTOSConfig.h └── main.c /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ## Code of Conduct 2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 4 | opensource-codeofconduct@amazon.com with any additional questions or comments. 5 | -------------------------------------------------------------------------------- /.github/SECURITY.md: -------------------------------------------------------------------------------- 1 | ## Reporting a Vulnerability 2 | 3 | If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security 4 | via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/) or directly via email to aws-security@amazon.com. 5 | Please do **not** create a public github issue. 6 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | Description 4 | ----------- 5 | 6 | 7 | Test Steps 8 | ----------- 9 | 10 | 11 | Related Issue 12 | ----------- 13 | 14 | 15 | 16 | By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. 17 | -------------------------------------------------------------------------------- /C2000_F2838x_C28x_CCS/port_validation/RegTests.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202112.00 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://aws.amazon.com/freertos 24 | * 25 | */ 26 | 27 | #ifndef REG_TEST_H 28 | #define REG_TEST_H 29 | 30 | void vStartRegisterTasks( UBaseType_t uxPriority ); 31 | BaseType_t xAreRegisterTasksStillRunning( void ); 32 | 33 | #endif /* REG_TEST_H */ 34 | -------------------------------------------------------------------------------- /C2000_F2838x_C28x_CCS/port_validation/TestRunner.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202112.00 3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://aws.amazon.com/freertos 24 | * 25 | */ 26 | 27 | #ifndef TEST_RUNNER_H 28 | #define TEST_RUNNER_H 29 | 30 | /** 31 | * Start all the tests. 32 | * 33 | * Note that this function starts the scheduler and therefore, never returns. 34 | */ 35 | void vStartTests( void ); 36 | 37 | #endif /* TEST_RUNNER_H */ 38 | -------------------------------------------------------------------------------- /C2000_F2838x_C28x_CCS/print_support/uart_drv.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************/ 2 | /* Must include stdio.h before this file for the definition of fpos_t */ 3 | /*****************************************************************************/ 4 | #include 5 | 6 | int UART_open(const char *path, unsigned flags, int llv_fd); 7 | int UART_close(int dev_fd); 8 | int UART_read(int dev_fd, char *buf, unsigned count); 9 | int UART_write(int dev_fd, const char *buf, unsigned count); 10 | fpos_t UART_lseek(int dev_fd, fpos_t offset, int origin); 11 | int UART_unlink(const char *path); 12 | int UART_rename(const char *old_name, const char *new_name); 13 | -------------------------------------------------------------------------------- /CORTEX_A9_Zynq7000_GCC/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.d 3 | -------------------------------------------------------------------------------- /CORTEX_A9_Zynq7000_GCC/FreeRTOSDemo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc. All rights reserved. 2 | # SPDX-License-Identifier: MIT 3 | cmake_minimum_required(VERSION 3.16) 4 | 5 | include(${CMAKE_CURRENT_SOURCE_DIR}/Hello_worldExample.cmake) 6 | include(${CMAKE_CURRENT_SOURCE_DIR}/UserConfig.cmake) 7 | set(APP_NAME hello_world) 8 | project(${APP_NAME}) 9 | 10 | enable_language(C ASM CXX) 11 | find_package(common) 12 | collect(PROJECT_LIB_DEPS xilstandalone) 13 | collect(PROJECT_LIB_DEPS xil) 14 | collect(PROJECT_LIB_DEPS gcc) 15 | collect(PROJECT_LIB_DEPS c) 16 | 17 | collect (PROJECT_LIB_SOURCES platform.c) 18 | collect (PROJECT_LIB_SOURCES helloworld.c) 19 | collector_list (_sources PROJECT_LIB_SOURCES) 20 | foreach (source ${_sources}) 21 | get_filename_component(ext ${source} EXT) 22 | list(APPEND src_ext ${ext}) 23 | endforeach() 24 | 25 | find_project_type ("${src_ext}" PROJECT_TYPE) 26 | 27 | if("${PROJECT_TYPE}" STREQUAL "c++") 28 | collect(PROJECT_LIB_DEPS stdc++) 29 | endif() 30 | collector_list (_deps PROJECT_LIB_DEPS) 31 | list (APPEND _deps ${USER_LINK_LIBRARIES}) 32 | 33 | if("${PROJECT_TYPE}" STREQUAL "c++") 34 | string (REPLACE ";" ",-l" _deps "${_deps}") 35 | endif() 36 | if(CMAKE_EXPORT_COMPILE_COMMANDS) 37 | set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}) 38 | set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}) 39 | endif() 40 | linker_gen("${CMAKE_CURRENT_SOURCE_DIR}/linker_files/") 41 | string(APPEND CMAKE_C_FLAGS ${USER_COMPILE_OPTIONS}) 42 | string(APPEND CMAKE_CXX_FLAGS ${USER_COMPILE_OPTIONS}) 43 | string(APPEND CMAKE_C_LINK_FLAGS ${USER_LINK_OPTIONS}) 44 | string(APPEND CMAKE_CXX_LINK_FLAGS ${USER_LINK_OPTIONS}) 45 | add_dependency_on_bsp(_sources) 46 | add_executable(${APP_NAME}.elf ${_sources}) 47 | set_target_properties(${APP_NAME}.elf PROPERTIES LINK_DEPENDS ${USER_LINKER_SCRIPT}) 48 | target_link_libraries(${APP_NAME}.elf -Wl,-T -Wl,\"${USER_LINKER_SCRIPT}\" -L\"${CMAKE_SOURCE_DIR}/\" -L\"${CMAKE_LIBRARY_PATH}/\" -L\"${USER_LINK_DIRECTORIES}/\" -Wl,--start-group,-l${_deps} -Wl,--end-group) 49 | target_compile_definitions(${APP_NAME}.elf PUBLIC ${USER_COMPILE_DEFINITIONS}) 50 | target_include_directories(${APP_NAME}.elf PUBLIC ${USER_INCLUDE_DIRECTORIES}) 51 | print_elf_size(CMAKE_SIZE ${APP_NAME}) 52 | -------------------------------------------------------------------------------- /CORTEX_A9_Zynq7000_GCC/FreeRTOSDemo/Demo/IntQueueTimer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202212.00 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. If you wish to use our Amazon 14 | * FreeRTOS name, please do so in a fair use way that does not cause confusion. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | * https://www.FreeRTOS.org 24 | * https://github.com/FreeRTOS 25 | * 26 | */ 27 | 28 | #ifndef INT_QUEUE_TIMER_H 29 | #define INT_QUEUE_TIMER_H 30 | 31 | /** 32 | * The function called from queue interrupt tests to initialise timer. 33 | */ 34 | void vInitialiseTimerForIntQueueTest( void ); 35 | 36 | /** 37 | * The function to be called from a timer handler. 38 | */ 39 | void IntQueueTestTimerHandler( void ); 40 | 41 | #endif /* INT_QUEUE_TIMER_H */ 42 | -------------------------------------------------------------------------------- /CORTEX_A9_Zynq7000_GCC/FreeRTOSDemo/Demo/RegTests.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202212.00 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | */ 26 | 27 | #ifndef REG_TEST_H 28 | #define REG_TEST_H 29 | 30 | void vStartRegisterTasks( UBaseType_t uxPriority ); 31 | BaseType_t xAreRegisterTasksStillRunning( void ); 32 | 33 | #endif /* REG_TEST_H */ 34 | -------------------------------------------------------------------------------- /CORTEX_A9_Zynq7000_GCC/FreeRTOSDemo/Demo/TestRunner.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202212.00 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | */ 26 | 27 | #ifndef TEST_RUNNER_H 28 | #define TEST_RUNNER_H 29 | 30 | /** 31 | * Start all the tests. 32 | * 33 | * Note that this function starts the scheduler and therefore, never returns. 34 | */ 35 | void vStartTests( void ); 36 | 37 | #endif /* TEST_RUNNER_H */ 38 | -------------------------------------------------------------------------------- /CORTEX_A9_Zynq7000_GCC/FreeRTOSDemo/Xilinx.spec: -------------------------------------------------------------------------------- 1 | *startfile: 2 | crti%O%s crtbegin%O%s 3 | -------------------------------------------------------------------------------- /CORTEX_A9_Zynq7000_GCC/FreeRTOSDemo/platform.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (C) 2023 Advanced Micro Devices, Inc. All Rights Reserved. 3 | * SPDX-License-Identifier: MIT 4 | ******************************************************************************/ 5 | 6 | #ifndef __PLATFORM_H_ 7 | #define __PLATFORM_H_ 8 | 9 | #ifndef SDT 10 | #include "platform_config.h" 11 | #endif 12 | 13 | void init_platform(); 14 | void cleanup_platform(); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /CORTEX_A9_Zynq7000_GCC/FreeRTOSDemo/platform_config.h: -------------------------------------------------------------------------------- 1 | #ifndef __PLATFORM_CONFIG_H_ 2 | #define __PLATFORM_CONFIG_H_ 3 | 4 | #define STDOUT_IS_PS7_UART 5 | #define UART_DEVICE_ID 0 6 | #endif 7 | -------------------------------------------------------------------------------- /CORTEX_A9_Zynq7000_GCC/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Matth9814 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /CORTEX_M0+_RP2040/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | **/cmake-*/ -------------------------------------------------------------------------------- /CORTEX_M0+_RP2040/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Note that this file can be used as a top level CMakeLists.txt to build all the Demos (it includes 2 | # them all, but they are usable in their own right, which is why no common work is done here) 3 | 4 | cmake_minimum_required(VERSION 3.13) 5 | 6 | # Pull in SDK (must be before project) 7 | include(pico_sdk_import.cmake) 8 | 9 | PROJECT(examples) 10 | 11 | add_subdirectory(OnEitherCore) 12 | add_subdirectory(Standard) 13 | add_subdirectory(UsingCMSIS) 14 | add_subdirectory(Standard_smp) 15 | -------------------------------------------------------------------------------- /CORTEX_M0+_RP2040/OnEitherCore/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 2 | 3 | # Pull in SDK (must be before project) 4 | include(pico_sdk_import.cmake) 5 | # Pull in FreeRTOS 6 | include(FreeRTOS_Kernel_import.cmake) 7 | 8 | project(example C CXX ASM) 9 | set(CMAKE_C_STANDARD 11) 10 | set(CMAKE_CXX_STANDARD 17) 11 | 12 | pico_sdk_init() 13 | 14 | add_library(on_either_core_common INTERFACE) 15 | target_sources(on_either_core_common INTERFACE 16 | main.c) 17 | target_include_directories(on_either_core_common INTERFACE 18 | ${CMAKE_CURRENT_LIST_DIR} 19 | ) 20 | target_link_libraries(on_either_core_common INTERFACE 21 | FreeRTOS-Kernel 22 | FreeRTOS-Kernel-Heap1 23 | pico_stdlib 24 | pico_multicore) 25 | 26 | add_executable(on_core_zero) 27 | target_link_libraries(on_core_zero on_either_core_common) 28 | pico_add_extra_outputs(on_core_zero) 29 | pico_enable_stdio_usb(on_core_zero 1) 30 | 31 | add_executable(on_core_one) 32 | target_link_libraries(on_core_one on_either_core_common) 33 | target_compile_definitions(on_core_one PRIVATE 34 | mainRUN_FREE_RTOS_ON_CORE=1 35 | PICO_STACK_SIZE=0x1000 36 | ) 37 | 38 | target_compile_options( on_core_one PUBLIC 39 | ### Gnu/Clang C Options 40 | $<$:-fdiagnostics-color=always> 41 | $<$:-fcolor-diagnostics> 42 | 43 | $<$:-Wall> 44 | $<$:-Wextra> 45 | $<$:-Werror> 46 | $<$:-Weverything> 47 | ) 48 | 49 | pico_add_extra_outputs(on_core_one) 50 | #pico_enable_stdio_usb(on_core_one 1) 51 | -------------------------------------------------------------------------------- /CORTEX_M0+_RP2040/OnEitherCore/README.md: -------------------------------------------------------------------------------- 1 | This demo pulls in CMSIS via the SDK 2 | -------------------------------------------------------------------------------- /CORTEX_M0+_RP2040/Standard/IntQueueTimer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202212.00 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | */ 26 | 27 | #ifndef INT_QUEUE_TIMER_H 28 | #define INT_QUEUE_TIMER_H 29 | 30 | void vInitialiseTimerForIntQueueTest( void ); 31 | portBASE_TYPE xTimer0Handler( void ); 32 | portBASE_TYPE xTimer1Handler( void ); 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /CORTEX_M0+_RP2040/Standard_smp/IntQueueTimer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202212.00 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | */ 26 | 27 | #ifndef INT_QUEUE_TIMER_H 28 | #define INT_QUEUE_TIMER_H 29 | 30 | void vInitialiseTimerForIntQueueTest( void ); 31 | portBASE_TYPE xTimer0Handler( void ); 32 | portBASE_TYPE xTimer1Handler( void ); 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /CORTEX_M0+_RP2040/UsingCMSIS/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 2 | 3 | # Pull in SDK (must be before project) 4 | include(pico_sdk_import.cmake) 5 | # Pull in FreeRTOS 6 | include(FreeRTOS_Kernel_import.cmake) 7 | 8 | project(example C CXX ASM) 9 | set(CMAKE_C_STANDARD 11) 10 | set(CMAKE_CXX_STANDARD 17) 11 | 12 | pico_sdk_init() 13 | 14 | add_executable(using_cmsis) 15 | target_sources(using_cmsis PUBLIC 16 | main.c) 17 | target_include_directories(using_cmsis PUBLIC 18 | ${CMAKE_CURRENT_LIST_DIR} 19 | ) 20 | 21 | target_compile_options( using_cmsis PUBLIC 22 | ### Gnu/Clang C Options 23 | $<$:-fdiagnostics-color=always> 24 | $<$:-fcolor-diagnostics> 25 | 26 | $<$:-Wall> 27 | $<$:-Wextra> 28 | $<$:-Werror> 29 | $<$:-Weverything> 30 | ) 31 | 32 | target_link_libraries(using_cmsis PUBLIC 33 | FreeRTOS-Kernel 34 | FreeRTOS-Kernel-Heap1 35 | pico_stdlib 36 | cmsis_core # CMSIS core headers via the SDK 37 | ) 38 | 39 | pico_add_extra_outputs(using_cmsis) 40 | -------------------------------------------------------------------------------- /CORTEX_M0+_RP2040/UsingCMSIS/README.md: -------------------------------------------------------------------------------- 1 | A simple example, that includes the CMSIS core headers via the Raspberry Pi Pico SDK (done 2 | by simpling adding `cmsis_core` to the `target_link_libraries()`) 3 | 4 | -------------------------------------------------------------------------------- /CORTEX_M0_FT32F072_KEIL/Source/Libraries/CMSIS/FT32F0xx/Include/system_ft32f0xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_ft32f0xx.h 4 | * @author FMD AE 5 | * @brief CMSIS Cortex-M0 Device Peripheral Access Layer System Header File. 6 | * @details 7 | * @version V1.0.0 8 | * @date 2021-07-01 9 | ******************************************************************************* 10 | */ 11 | 12 | /** 13 | * @brief Define to prevent recursive inclusion 14 | */ 15 | #ifndef __SYSTEM_FT32F0xx_H 16 | #define __SYSTEM_FT32F0xx_H 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 23 | 24 | extern void SystemInit(void); 25 | extern void SystemCoreClockUpdate(void); 26 | /** 27 | * @} 28 | */ 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif /* */ 35 | 36 | /** 37 | * @} 38 | */ 39 | 40 | /** 41 | * @} 42 | */ 43 | /************************ (C) COPYRIGHT FMD *****END OF FILE****/ 44 | -------------------------------------------------------------------------------- /CORTEX_M0_FT32F072_KEIL/Source/Libraries/FT32F0xx_Driver/Inc/ft32f0xx_dac.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file ft32f0xx_dac.h 4 | * @author FMD AE 5 | * @brief This file contains all the functions prototypes for the DAC firmware 6 | * library. 7 | * @version V1.0.0 8 | * @data 2021-07-01 9 | ****************************************************************************** 10 | */ 11 | #ifndef __FT32F0XX_DAC_H 12 | #define __FT32F0XX_DAC_H 13 | 14 | 15 | #include "ft32f0xx.h" 16 | 17 | 18 | 19 | /** 20 | * @Parama DAC_CTRL 21 | */ 22 | 23 | #define DAC_DATA_RESET ((uint32_t)(0x0000007f)) 24 | 25 | #define DAC_CTRL_READ (uint8_t)(0x20) 26 | #define DAC_DATA1_READ (uint8_t)(0x24) 27 | #define DAC_DATA2_READ (uint8_t)(0x28) 28 | 29 | 30 | #define IS_DAC_DATA(DATA) ((DATA) <= 0x7F) 31 | 32 | 33 | /** 34 | * @Parama DAC1_DATA 35 | */ 36 | void DAC_Ref_Config(uint32_t DAC_RefSel); 37 | void Bsp_DAC_Config(void); 38 | uint8_t DAC_Read_Reg(uint8_t DAC_Register); 39 | void DAC_Cmd(FunctionalState NewState); 40 | void DAC_SetChannel1Data(uint32_t DAC_Align, uint8_t Data); 41 | void DAC_SetChannel2Data(uint32_t DAC_Align, uint8_t Data); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /CORTEX_M0_FT32F072_KEIL/Source/Libraries/FT32F0xx_Driver/Src/ft32f0xx_dac.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file ft32f0xx_dac.c 4 | * @author FMD AE 5 | * @brief This file provides firmware functions to manage the following 6 | * functionalities of DAC peripheral 7 | * @version V1.0.0 8 | * @data 2021-07-01 9 | ****************************************************************************** 10 | */ 11 | /* Includes ------------------------------------------------------------------*/ 12 | #include "ft32f0xx_dac.h" 13 | 14 | /** 15 | * 16 | */ 17 | void DAC_Ref_Config(uint32_t DAC_RefSel) 18 | { 19 | uint32_t tmpreg = 0; 20 | 21 | assert_param(IS_DAC_REF_SEL(DAC_RefSel)); 22 | 23 | tmpreg = DAC->CTRL; 24 | tmpreg &= ~DAC_CTRL_REF_SEL; 25 | tmpreg |= DAC_RefSel; 26 | 27 | DAC->CTRL |= tmpreg; 28 | } 29 | /** 30 | * @Parame 31 | */ 32 | void DAC_Cmd(FunctionalState NewState) 33 | { 34 | if(NewState != DISABLE) 35 | { 36 | DAC->CTRL |= DAC_CTRL_EN; 37 | } 38 | else 39 | { 40 | DAC->CTRL &= ~DAC_CTRL_EN; 41 | } 42 | } 43 | 44 | 45 | /** 46 | * @brief Set the specified data holding register value for DAC channel1. 47 | * @param DAC_Align: no use. 48 | * @param Data: Data to be loaded in the selected data DAC1DATA register. 7BIT 49 | * @retval None 50 | */ 51 | void DAC_SetChannel1Data(uint32_t DAC_Align, uint8_t Data) 52 | { 53 | /* Check the parameters */ 54 | assert_param(IS_DAC_DATA(Data)); 55 | 56 | DAC->DATA1 = (uint32_t)Data; 57 | } 58 | 59 | void DAC_SetChannel2Data(uint32_t DAC_Align, uint8_t Data) 60 | { 61 | /* Check the parameters */ 62 | assert_param(IS_DAC_DATA(Data)); 63 | 64 | DAC->DATA2 = (uint32_t)Data; 65 | } 66 | 67 | 68 | 69 | /** 70 | * @Parame 71 | * 72 | */ 73 | uint8_t DAC_Read_Reg(uint8_t DAC_Register) 74 | { 75 | __IO uint32_t tmp = 0; 76 | 77 | tmp = (uint32_t)DAC_BASE; 78 | tmp += DAC_Register; 79 | 80 | /* Return the selected register value */ 81 | return (uint8_t)(*(__IO uint32_t *) tmp); 82 | } 83 | -------------------------------------------------------------------------------- /CORTEX_M0_FT32F072_KEIL/Source/Tasks/inc/HighProTask.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file HighProTask.h 4 | * @author FMD AE 5 | * @brief HighProTask Header File. 6 | * @version V1.0.0 7 | * @data 2021-09-27 8 | ****************************************************************************** 9 | * @attention 10 | * COPYRIGHT (C) 2021 Fremont Micro Devices (SZ) Corporation All rights reserved. 11 | * This software is provided by the copyright holders and contributors,and the 12 | *software is believed to be accurate and reliable. However, Fremont Micro Devices 13 | *(SZ) Corporation assumes no responsibility for the consequences of use of such 14 | *software or for any infringement of patents of other rights of third parties, 15 | *which may result from its use. No license is granted by implication or otherwise 16 | *under any patent rights of Fremont Micro Devices (SZ) Corporation. 17 | * ****************************************************************************** 18 | */ 19 | 20 | 21 | #ifndef __HIGHPROTASK_H__ 22 | #define __HIGHPROTASK_H__ 23 | /* Includes ---------------------------------------------------------------------*/ 24 | #include "config.h" 25 | #include "TaskManager.h" 26 | #include "LowProTask.h" 27 | /* Public Constant prototypes----------------------------------------------------*/ 28 | /* Public typedef ---------------------------------------------------------------*/ 29 | /* Public define ----------------------------------------------------------------*/ 30 | /* Public variables prototypes --------------------------------------------------*/ 31 | extern xQueueHandle xHighProTaskQueue; 32 | 33 | /* Public function prototypes----------------------------------------------------*/ 34 | void CreateHighProTask(void); 35 | 36 | #endif 37 | /************************* (C) COPYRIGHT FMD *****END OF FILE*********************/ 38 | -------------------------------------------------------------------------------- /CORTEX_M0_FT32F072_KEIL/Source/Tasks/inc/IdleTask.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file IdleTask.h 4 | * @author FMD AE 5 | * @brief IdleTask Header File. 6 | * @version V1.0.0 7 | * @data 2021-09-27 8 | ****************************************************************************** 9 | * @attention 10 | * COPYRIGHT (C) 2021 Fremont Micro Devices (SZ) Corporation All rights reserved. 11 | * This software is provided by the copyright holders and contributors,and the 12 | *software is believed to be accurate and reliable. However, Fremont Micro Devices 13 | *(SZ) Corporation assumes no responsibility for the consequences of use of such 14 | *software or for any infringement of patents of other rights of third parties, 15 | *which may result from its use. No license is granted by implication or otherwise 16 | *under any patent rights of Fremont Micro Devices (SZ) Corporation. 17 | * ****************************************************************************** 18 | */ 19 | 20 | #ifndef __IDLETASK_H__ 21 | #define __IDLETASK_H__ 22 | /* Includes ---------------------------------------------------------------------*/ 23 | #include "config.h" 24 | /* Public Constant prototypes----------------------------------------------------*/ 25 | /* Public typedef ---------------------------------------------------------------*/ 26 | /* Public define ----------------------------------------------------------------*/ 27 | /* Public variables prototypes --------------------------------------------------*/ 28 | /* Public function prototypes----------------------------------------------------*/ 29 | #ifdef __cplusplus 30 | extern "C" 31 | { 32 | #endif 33 | 34 | void vApplicationIdleHook(void); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif 41 | /************************* (C) COPYRIGHT FMD *****END OF FILE*********************/ 42 | -------------------------------------------------------------------------------- /CORTEX_M0_FT32F072_KEIL/Source/Tasks/inc/InitTask.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file InitTask.h 4 | * @author FMD AE 5 | * @brief InitTask Header File. 6 | * @version V1.0.0 7 | * @data 2021-09-27 8 | ****************************************************************************** 9 | * @attention 10 | * COPYRIGHT (C) 2021 Fremont Micro Devices (SZ) Corporation All rights reserved. 11 | * This software is provided by the copyright holders and contributors,and the 12 | *software is believed to be accurate and reliable. However, Fremont Micro Devices 13 | *(SZ) Corporation assumes no responsibility for the consequences of use of such 14 | *software or for any infringement of patents of other rights of third parties, 15 | *which may result from its use. No license is granted by implication or otherwise 16 | *under any patent rights of Fremont Micro Devices (SZ) Corporation. 17 | * ****************************************************************************** 18 | */ 19 | #ifndef _INIT_TASK_H_ 20 | #define _INIT_TASK_H_ 21 | 22 | /* Includes ---------------------------------------------------------------------*/ 23 | #include "config.h" 24 | #include "HighProTask.h" 25 | #include "TaskManager.h" 26 | #include "LowProTask.h" 27 | /* Public Constant prototypes----------------------------------------------------*/ 28 | /* Public typedef ---------------------------------------------------------------*/ 29 | /* Public define ----------------------------------------------------------------*/ 30 | /* Public variables prototypes --------------------------------------------------*/ 31 | /* Public function prototypes----------------------------------------------------*/ 32 | void CreateInitTask(void); 33 | 34 | #endif 35 | /************************* (C) COPYRIGHT FMD *****END OF FILE*********************/ -------------------------------------------------------------------------------- /CORTEX_M0_FT32F072_KEIL/Source/Tasks/inc/LowProTask.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file LowProTask.h 4 | * @author FMD AE 5 | * @brief LowProTask Header File. 6 | * @version V1.0.0 7 | * @data 2021-09-27 8 | ****************************************************************************** 9 | * @attention 10 | * COPYRIGHT (C) 2021 Fremont Micro Devices (SZ) Corporation All rights reserved. 11 | * This software is provided by the copyright holders and contributors,and the 12 | *software is believed to be accurate and reliable. However, Fremont Micro Devices 13 | *(SZ) Corporation assumes no responsibility for the consequences of use of such 14 | *software or for any infringement of patents of other rights of third parties, 15 | *which may result from its use. No license is granted by implication or otherwise 16 | *under any patent rights of Fremont Micro Devices (SZ) Corporation. 17 | * ****************************************************************************** 18 | */ 19 | #ifndef __LOW_PRIORITY_TASK_H__ 20 | #define __LOW_PRIORITY_TASK_H__ 21 | /* Includes ---------------------------------------------------------------------*/ 22 | #include "config.h" 23 | #include "TaskManager.h" 24 | /* Public Constant prototypes----------------------------------------------------*/ 25 | /* Public typedef ---------------------------------------------------------------*/ 26 | /* Public define ----------------------------------------------------------------*/ 27 | /* Public variables prototypes --------------------------------------------------*/ 28 | extern xQueueHandle xLowProTaskQueue; 29 | 30 | /* Public function prototypes----------------------------------------------------*/ 31 | void CreateLowProTask(void); 32 | 33 | #endif 34 | /************************* (C) COPYRIGHT FMD *****END OF FILE*********************/ 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /CORTEX_M0_FT32F072_KEIL/Source/User/inc/appconfig.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeRTOS/FreeRTOS-Community-Supported-Demos/b3c0438523378449c4190d1e5f673ab2583c17aa/CORTEX_M0_FT32F072_KEIL/Source/User/inc/appconfig.h -------------------------------------------------------------------------------- /CORTEX_M0_FT32F072_KEIL/Source/User/inc/ft32f0xx_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file FT32F0xx_it.h 4 | * @author FMD AE 5 | * @brief FT32F0xx_it Header File. 6 | * @version V1.0.0 7 | * @data 2021-09-27 8 | ****************************************************************************** 9 | * @attention 10 | * COPYRIGHT (C) 2021 Fremont Micro Devices (SZ) Corporation All rights reserved. 11 | * This software is provided by the copyright holders and contributors,and the 12 | *software is believed to be accurate and reliable. However, Fremont Micro Devices 13 | *(SZ) Corporation assumes no responsibility for the consequences of use of such 14 | *software or for any infringement of patents of other rights of third parties, 15 | *which may result from its use. No license is granted by implication or otherwise 16 | *under any patent rights of Fremont Micro Devices (SZ) Corporation. 17 | * ****************************************************************************** 18 | */ 19 | #ifndef __FT32F0XX_it_H 20 | #define __FT32F0XX_it_H 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | /* Includes ---------------------------------------------------------------------*/ 26 | #include "main.h" 27 | #include "config.h" 28 | #include "HighProTask.h" 29 | #include "TaskManager.h" 30 | #include "LowProTask.h" 31 | /* Public Constant prototypes----------------------------------------------------*/ 32 | /* Public typedef ---------------------------------------------------------------*/ 33 | /* Public define ----------------------------------------------------------------*/ 34 | /* Public variables prototypes --------------------------------------------------*/ 35 | /* Public function prototypes----------------------------------------------------*/ 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif /* __FT32F0XX_it_H */ 41 | 42 | /************************* (C) COPYRIGHT FMD *****END OF FILE*********************/ 43 | 44 | -------------------------------------------------------------------------------- /CORTEX_M0_FT32F072_KEIL/Source/User/inc/main.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file main.h 4 | * @author FMD AE 5 | * @brief main Header File. 6 | * @version V1.0.0 7 | * @data 2021-09-27 8 | ****************************************************************************** 9 | * @attention 10 | * COPYRIGHT (C) 2021 Fremont Micro Devices (SZ) Corporation All rights reserved. 11 | * This software is provided by the copyright holders and contributors,and the 12 | *software is believed to be accurate and reliable. However, Fremont Micro Devices 13 | *(SZ) Corporation assumes no responsibility for the consequences of use of such 14 | *software or for any infringement of patents of other rights of third parties, 15 | *which may result from its use. No license is granted by implication or otherwise 16 | *under any patent rights of Fremont Micro Devices (SZ) Corporation. 17 | * ****************************************************************************** 18 | */ 19 | #ifndef __MAIN_H 20 | #define __MAIN_H 21 | 22 | /* Includes ---------------------------------------------------------------------*/ 23 | #include "config.h" 24 | /* Public Constant prototypes----------------------------------------------------*/ 25 | /* Public typedef ---------------------------------------------------------------*/ 26 | /* Public define ----------------------------------------------------------------*/ 27 | /* Public variables prototypes --------------------------------------------------*/ 28 | /* Public function prototypes----------------------------------------------------*/ 29 | 30 | #endif /* __MAIN_H */ 31 | 32 | /************************* (C) COPYRIGHT FMD *****END OF FILE*********************/ 33 | -------------------------------------------------------------------------------- /CORTEX_M4F_TM4C123G_Launchpad_GCC/Blinky_Demo/TM4C123GH6PM.ld: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 4 | SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0X00008000 5 | } 6 | 7 | SECTIONS 8 | { 9 | /* code */ 10 | .text : 11 | { 12 | _text = .; 13 | /* ensure ISR vectors are not removed by linker */ 14 | KEEP(*(.isr_vector)) 15 | *(.text*) 16 | *(.rodata*) 17 | _etext = .; 18 | } > FLASH 19 | 20 | /* static data */ 21 | .data : AT(ADDR(.text) + SIZEOF(.text)) 22 | { 23 | _data = .; 24 | *(vtable) 25 | *(.data*) 26 | _edata = .; 27 | } > SRAM 28 | 29 | /* static uninitialized data */ 30 | .bss : 31 | { 32 | _bss = .; 33 | *(.bss*) 34 | *(COMMON) 35 | _ebss = .; 36 | } > SRAM 37 | 38 | } 39 | -------------------------------------------------------------------------------- /CORTEX_M4F_TM4C123G_Launchpad_GCC/Full_Demo/Full_Template/IntQueueTimer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202112.00 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. If you wish to use our Amazon 14 | * FreeRTOS name, please do so in a fair use way that does not cause confusion. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | * https://www.FreeRTOS.org 24 | * https://aws.amazon.com/freertos 25 | * 26 | */ 27 | 28 | #ifndef INT_QUEUE_TIMER_H 29 | #define INT_QUEUE_TIMER_H 30 | 31 | /** 32 | * The function called from queue interrupt tests to initialise timer. 33 | */ 34 | void vInitialiseTimerForIntQueueTest( void ); 35 | 36 | /** 37 | * The function to be called from a timer handler. 38 | */ 39 | void IntQueueTestTimerHandler( void ); 40 | 41 | #endif /* INT_QUEUE_TIMER_H */ 42 | -------------------------------------------------------------------------------- /CORTEX_M4F_TM4C123G_Launchpad_GCC/Full_Demo/Full_Template/RegTests.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202112.00 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://aws.amazon.com/freertos 24 | * 25 | */ 26 | 27 | #ifndef REG_TEST_H 28 | #define REG_TEST_H 29 | 30 | void vStartRegisterTasks( UBaseType_t uxPriority ); 31 | BaseType_t xAreRegisterTasksStillRunning( void ); 32 | 33 | #endif /* REG_TEST_H */ 34 | -------------------------------------------------------------------------------- /CORTEX_M4F_TM4C123G_Launchpad_GCC/Full_Demo/Full_Template/TestRunner.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202112.00 3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://aws.amazon.com/freertos 24 | * 25 | */ 26 | 27 | #ifndef TEST_RUNNER_H 28 | #define TEST_RUNNER_H 29 | 30 | /** 31 | * Start all the tests. 32 | * 33 | * Note that this function starts the scheduler and therefore, never returns. 34 | */ 35 | void vStartTests( void ); 36 | 37 | #endif /* TEST_RUNNER_H */ 38 | -------------------------------------------------------------------------------- /CORTEX_M4F_TM4C123G_Launchpad_GCC/Full_Demo/TM4C123GH6PM.ld: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 4 | SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0X00008000 5 | } 6 | 7 | SECTIONS 8 | { 9 | /* code */ 10 | .text : 11 | { 12 | _text = .; 13 | /* ensure ISR vectors are not removed by linker */ 14 | KEEP(*(.isr_vector)) 15 | *(.text*) 16 | *(.rodata*) 17 | _etext = .; 18 | } > FLASH 19 | 20 | /* static data */ 21 | .data : AT(ADDR(.text) + SIZEOF(.text)) 22 | { 23 | _data = .; 24 | *(vtable) 25 | *(.data*) 26 | _edata = .; 27 | } > SRAM 28 | 29 | /* static uninitialized data */ 30 | .bss : 31 | { 32 | _bss = .; 33 | *(.bss*) 34 | *(COMMON) 35 | _ebss = .; 36 | } > SRAM 37 | 38 | } 39 | -------------------------------------------------------------------------------- /CORTEX_M4F_TM4C123G_Launchpad_GCC/README.md: -------------------------------------------------------------------------------- 1 | OVERVIEW 2 | 3 | This project containes demo app for TM4C123GH6PM board by TI. 4 | 5 | Demo : 6 | 1. blinky 7 | 2. Full 8 | 9 | First, you should get the `arm-none-eabi-gcc` tool-chain. You may have the `lm4flash` tool to flash kernel for TM4C123G on Linux/Unix OS. 10 | 11 | Second, you should put this project at `FreeRTOS/FreeRTOS/Demo/ThirdPart/Community-Supported-Demos/` directory. 12 | 13 | 1. blinky Demo 14 | 15 | Then, build and flash: 16 | 17 | ``` 18 | $ cd Blinky_Demo 19 | $ make 20 | $ lm4flash gcc/blinky.bin 21 | ``` 22 | 23 | 2. Full Demo 24 | ``` 25 | $ cd Full_Demo 26 | $ make 27 | $ lm4flash gcc/full.bin 28 | ``` 29 | 30 | To see the console output for the test results, serial port should be configured as: 31 | - baud rate : 115200 32 | - data : 8-bits 33 | - parity : N 34 | - stopo bit: 1-bits 35 | - flow control none 36 | 37 | NOTE: 38 | a. To avoid memory issues, the tests are grouped into 2 sections. Update TESTGROUP to select the desired group or alternatively run tests one by one by defining configSTART__TESTS macros to 0 or 1 as needed. 39 | 40 | REFERENCES: 41 | https://www.ti.com/product/TM4C123GH6PM 42 | -------------------------------------------------------------------------------- /CORTEX_M4F_TM4C123G_Launchpad_GCC/driverlib/driverlib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------- 3 | * Tiva driver lib 2.2.0 4 | * ------------------------------------------- 5 | */ 6 | 7 | #ifndef __DRIVERLIB__H_ 8 | #define __DRIVERLIB__H_ 9 | #include 10 | 11 | #include "sysctl.h" 12 | #include "gpio.h" 13 | #include "uart.h" 14 | #include "pin_map.h" 15 | #include "i2c.h" 16 | #include "cpu.h" 17 | #include "rom_map.h" 18 | #include "rom.h" 19 | #include "usb.h" 20 | #include "timer.h" 21 | 22 | #include "inc/hw_adc.h" 23 | #include "inc/hw_aes.h" 24 | #include "inc/hw_can.h" 25 | #include "inc/hw_ccm.h" 26 | #include "inc/hw_comp.h" 27 | #include "inc/hw_des.h" 28 | #include "inc/hw_eeprom.h" 29 | #include "inc/hw_emac.h" 30 | #include "inc/hw_epi.h" 31 | #include "inc/hw_fan.h" 32 | #include "inc/hw_flash.h" 33 | #include "inc/hw_gpio.h" 34 | #include "inc/hw_hibernate.h" 35 | #include "inc/hw_i2c.h" 36 | #include "inc/hw_ints.h" 37 | #include "inc/hw_lcd.h" 38 | #include "inc/hw_memmap.h" 39 | #include "inc/hw_nvic.h" 40 | #include "inc/hw_onewire.h" 41 | #include "inc/hw_pwm.h" 42 | #include "inc/hw_qei.h" 43 | #include "inc/hw_shamd5.h" 44 | #include "inc/hw_ssi.h" 45 | #include "inc/hw_sysctl.h" 46 | #include "inc/hw_sysexc.h" 47 | #include "inc/hw_timer.h" 48 | #include "inc/hw_types.h" 49 | #include "inc/hw_uart.h" 50 | #include "inc/hw_udma.h" 51 | #include "inc/hw_usb.h" 52 | #include "inc/hw_watchdog.h" 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /CORTEX_M4F_TM4C123G_Launchpad_GCC/driverlib/epi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeRTOS/FreeRTOS-Community-Supported-Demos/b3c0438523378449c4190d1e5f673ab2583c17aa/CORTEX_M4F_TM4C123G_Launchpad_GCC/driverlib/epi.h -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This repository contains multiple directories, each individually licensed. Please see the LICENSE file in each directory. 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## FreeRTOS Community Supported Demos 2 | 3 | This repository contains demos for FreeRTOS ports supported by FreeRTOS 4 | community members. Follow [these steps](https://github.com/FreeRTOS/FreeRTOS/blob/main/FreeRTOS/Demo/ThirdParty/Template/README.md) to contribute a demo to this repository. 5 | 6 | ## License 7 | 8 | This repository contains multiple directories, each individually licensed. Please see the LICENSE file in each directory. 9 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/.gitignore: -------------------------------------------------------------------------------- 1 | /HardwareDebug 2 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | RH850_F1KM_RTOS 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | 14 | 15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 16 | full,incremental, 17 | 18 | 19 | 20 | 21 | com.renesas.cdt.managedbuild.renesas.misrachecker.builder 22 | 23 | 24 | 25 | 26 | 27 | org.eclipse.cdt.core.cnature 28 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 29 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 30 | 31 | 32 | 33 | freertos/Common 34 | 2 35 | $%7BRTOS_ROOT%7D/FreeRTOS/Demo/Common 36 | 37 | 38 | freertos/freertos_kernel 39 | 2 40 | $%7BRTOS_SOURCE%7D 41 | 42 | 43 | freertos/freertos_port 44 | 2 45 | $%7BRTOS_ROOT%7D/FreeRTOS/Source/portable/ThirdParty/Community-Supported-Ports/CCRH/RH850_F1KM_S4 46 | 47 | 48 | 49 | 50 | RTOS_ROOT 51 | $%7BPARENT-5-PROJECT_LOC%7D 52 | 53 | 54 | RTOS_SOURCE 55 | $%7BRTOS_ROOT%7D/FreeRTOS/Source 56 | 57 | 58 | RTOS_SOURCE_INCLUDE 59 | $%7BRTOS_ROOT%7D/FreeRTOS/Source/Include 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/.settings/CoverageSetting.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1.0 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/.settings/DebugVirtualConsoleSetting.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | false 6 | 7 | false 8 | 9 | 0 10 | true 11 | false 12 | 13 | 14 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/.settings/Dependency_Scan_Preferences.prefs: -------------------------------------------------------------------------------- 1 | DependecyMode=ScanBuildDep 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/.settings/IORegisterSetting.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | RESF 5 | 6 | 7 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/.settings/com.renesas.hardwaredebug.rh850.e1.PerfAnalysisSettings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1.1 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/.settings/com.renesas.tools.misrac.prefs: -------------------------------------------------------------------------------- 1 | applyRule=Apply all rules 2 | eclipse.preferences.version=1 3 | exclusionRuleNumber= 4 | isMisracRuleCheck=false 5 | isUseCompilerSetting=false 6 | misra2004=true 7 | misra2012=false 8 | outputFormat=TXT Files (*.txt) 9 | ruleNumber= 10 | ruleNumberDescriptionFile= 11 | saveToFile=No save 12 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/.settings/e2studio_project.prefs: -------------------------------------------------------------------------------- 1 | # 2 | #Thu Feb 29 15:18:53 ICT 2024 3 | activeConfiguration=com.renesas.cdt.managedbuild.renesas.ccrh.hardwaredebug.configuration.1239971482 4 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/.settings/org.eclipse.cdt.core.prefs: -------------------------------------------------------------------------------- 1 | doxygen/doxygen_new_line_after_brief=true 2 | doxygen/doxygen_use_brief_tag=false 3 | doxygen/doxygen_use_javadoc_tags=true 4 | doxygen/doxygen_use_pre_tag=false 5 | doxygen/doxygen_use_structural_commands=false 6 | eclipse.preferences.version=1 7 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/.settings/org.eclipse.ltk.core.refactoring.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false 3 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/.settings/renesasPGModel.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | LITTLE 4 | 5 | 6 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/README.md: -------------------------------------------------------------------------------- 1 | # RH850 F1KM-S4 FreeRTOS Community Supported Demo 2 | 3 | ## Introduction 4 | This directory contains demo project for Renesas RH850 F1KM-S4 R7F701649 5 | 6 | This example implements the standard test demos detailed in following link: [RTOS Third Party Demo](https://github.com/FreeRTOS/FreeRTOS/blob/main/FreeRTOS/Demo/ThirdParty/Template/README.md) 7 | 8 | ## IDE 9 | - [E2Studio suport RH850 family](https://www.renesas.com/us/en/software-tool/e2studio-information-rh850-family) 10 | 11 | ## How to use 12 | Open e2studio and import this project File->Open Projects from File System 13 | 14 | In order to see log you can add your thread safe transmit function in here or use Dynamic printf feature supported by E2Studio. 15 | 16 | ```c 17 | int printf (const char * format, ...) 18 | { 19 | char tx_buff[100]; 20 | va_list arg; 21 | va_start(arg, format); 22 | vsprintf(tx_buff, format, arg); 23 | va_end(arg); 24 | 25 | /* Put your transmit function here */ 26 | 27 | return 0; 28 | } 29 | 30 | ``` 31 | 32 | Select test case you want to run by changing definition `configSTART__TESTS` in `freertos\FreeRTOSConfig.h` macros to `0` or ` 1` as needed 33 | 34 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/bsp/bsp_irq/bsp_irq.c: -------------------------------------------------------------------------------- 1 | #include "bsp_common.h" 2 | 3 | extern irq_vector_t g_vector_table[BSP_VECTOR_TABLE_MAX_ENTRIES]; 4 | 5 | void bsp_common_interrupt_handler (uint32_t id) 6 | { 7 | g_vector_table[id](); 8 | } 9 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/bsp/bsp_irq/bsp_irq.h: -------------------------------------------------------------------------------- 1 | #ifndef BSP_IRQ_BSP_IRQ_H_ 2 | #define BSP_IRQ_BSP_IRQ_H_ 3 | 4 | #define BSP_FE_VECTOR_TABLE_ENTRIES (32) 5 | #define BSP_EIC_VECTOR_TABLE_ENTRIES (377) 6 | #define BSP_VECTOR_TABLE_MAX_ENTRIES (409) 7 | 8 | typedef void (* irq_vector_t)(void); 9 | 10 | void bsp_common_interrupt_handler(uint32_t id); 11 | 12 | #endif /* BSP_IRQ_BSP_IRQ_H_ */ 13 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/bsp/bsp_irq/vector_data.c: -------------------------------------------------------------------------------- 1 | #include "bsp_common.h" 2 | 3 | const irq_vector_t g_vector_table[BSP_VECTOR_TABLE_MAX_ENTRIES] = 4 | { 5 | [48] = TAUD0I1_Handler, 6 | [49] = TAUD0I3_Handler, 7 | [84] = vPortTickISR 8 | }; 9 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/bsp/bsp_irq/vector_data.h: -------------------------------------------------------------------------------- 1 | #ifndef BSP_IRQ_VECTOR_DATA_H_ 2 | #define BSP_IRQ_VECTOR_DATA_H_ 3 | 4 | extern void vPortTickISR(void); 5 | 6 | extern void TAUD0I1_Handler(void); 7 | extern void TAUD0I3_Handler(void); 8 | 9 | #endif /* BSP_IRQ_VECTOR_DATA_H_ */ 10 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/bsp/common/bsp_common.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMON_BSP_COMMON_H_ 2 | #define COMMON_COMMON_H_ 3 | 4 | #include 5 | #include "iodefine.h" 6 | #include "bsp_compiler_support.h" 7 | #include "bsp_macro.h" 8 | #include "../bsp_clock/bsp_clock.h" 9 | #include "../bsp_irq/bsp_irq.h" 10 | #include "../bsp_irq/vector_data.h" 11 | 12 | #endif /* COMMON_BSP_COMMON_H_ */ 13 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/bsp/common/bsp_compiler_support.h: -------------------------------------------------------------------------------- 1 | /* 2 | * bsp_compiler_support.h 3 | * 4 | * Created on: Feb 27, 2024 5 | * Author: tin.nguyen-van 6 | */ 7 | 8 | #ifndef COMMON_BSP_COMPILER_SUPPORT_H_ 9 | #define COMMON_BSP_COMPILER_SUPPORT_H_ 10 | 11 | #if defined(__CCRH__) 12 | #define BSP_DONT_REMOVE 13 | #define EIPC 0 14 | #define EIPSW 1 15 | #define FEPC 2 16 | #define FEPSW 3 17 | #define PSW 5 18 | #define FPSR 6 19 | #define FPEPC 7 20 | #define FPST 8 21 | #define FPCC 9 22 | #define FPCFG 10 23 | #define FPEC 11 24 | #define EIIC 13 25 | #define FEIC 14 26 | #define CTPC 16 27 | #define CTPSW 17 28 | #define CTBP 20 29 | #define EIWR 28 30 | #define FEWR 29 31 | 32 | #define DI() __DI() 33 | #define EI() __EI() 34 | #define HALT() __halt() 35 | #define NOP() __nop() 36 | #define SYNCP() __syncp() 37 | #define SCH1R(x) __sch1r((x)) 38 | #define LDSR(regid, ret) __ldsr((regid), (ret)) 39 | #define STSR(regid) __stsr((regid)) 40 | #endif 41 | 42 | #endif /* COMMON_BSP_COMPILER_SUPPORT_H_ */ 43 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/bsp/common/bsp_macro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * bsp_macro.h 3 | * 4 | * Created on: Feb 27, 2024 5 | * Author: tin.nguyen-van 6 | */ 7 | 8 | #ifndef COMMON_BSP_MACRO_H_ 9 | #define COMMON_BSP_MACRO_H_ 10 | 11 | #define _WRITE_PROTECT_COMMAND (0x000000A5UL) /* Write protected */ 12 | 13 | #endif /* COMMON_BSP_MACRO_H_ */ 14 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/src/IntQueueTimer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202212.00 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. If you wish to use our Amazon 14 | * FreeRTOS name, please do so in a fair use way that does not cause confusion. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | * https://www.FreeRTOS.org 24 | * https://github.com/FreeRTOS 25 | * 26 | */ 27 | 28 | #ifndef INT_QUEUE_TIMER_H 29 | #define INT_QUEUE_TIMER_H 30 | 31 | /** 32 | * The function called from queue interrupt tests to initialise timer. 33 | */ 34 | void vInitialiseTimerForIntQueueTest(void); 35 | 36 | /** 37 | * The function to be called from a timer handler. 38 | */ 39 | void IntQueueTestTimerHandler(void); 40 | 41 | #endif /* INT_QUEUE_TIMER_H */ 42 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/src/RegTests.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202212.00 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | */ 26 | 27 | #ifndef REG_TEST_H 28 | #define REG_TEST_H 29 | 30 | void vStartRegisterTasks(UBaseType_t uxPriority); 31 | BaseType_t xAreRegisterTasksStillRunning(void); 32 | 33 | #endif /* REG_TEST_H */ 34 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/src/TestRunner.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202212.00 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | */ 26 | 27 | #ifndef TEST_RUNNER_H 28 | #define TEST_RUNNER_H 29 | 30 | /** 31 | * Start all the tests. 32 | * 33 | * Note that this function starts the scheduler and therefore, never returns. 34 | */ 35 | void vStartTests(void); 36 | 37 | #endif /* TEST_RUNNER_H */ 38 | -------------------------------------------------------------------------------- /RH850_F1KM_S4_CCRH/src/main.c: -------------------------------------------------------------------------------- 1 | #include "bsp_common.h" 2 | #include "TestRunner.h" 3 | #include 4 | #include 5 | 6 | int main(void); 7 | 8 | int main (void) 9 | { 10 | bsp_clock_init(); 11 | printf("Start of program\r\n"); 12 | 13 | vStartTests(); 14 | 15 | return 0; 16 | } 17 | 18 | int printf (const char * format, ...) 19 | { 20 | char tx_buff[100]; 21 | va_list arg; 22 | va_start(arg, format); 23 | vsprintf(tx_buff, format, arg); 24 | va_end(arg); 25 | 26 | /* Put your transmit function here */ 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/Image/Linker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeRTOS/FreeRTOS-Community-Supported-Demos/b3c0438523378449c4190d1e5f673ab2583c17aa/RH850_F1Kx_CCRH/Image/Linker.png -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_MultiCore/.gitignore: -------------------------------------------------------------------------------- 1 | /HardwareDebug 2 | *.rcpc 3 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_MultiCore/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | RH850_F1K_MULTI 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | 14 | 15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 16 | full,incremental, 17 | 18 | 19 | 20 | 21 | com.renesas.cdt.managedbuild.renesas.misrachecker.builder 22 | 23 | 24 | 25 | 26 | 27 | org.eclipse.cdt.core.cnature 28 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 29 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 30 | 31 | 32 | 33 | freertos/Common 34 | 2 35 | $%7BRTOS_ROOT%7D/FreeRTOS/Demo/Common 36 | 37 | 38 | freertos/freertos_kernel 39 | 2 40 | $%7BRTOS_SOURCE%7D 41 | 42 | 43 | 44 | 45 | RTOS_ROOT 46 | $%7BPARENT-6-PROJECT_LOC%7D 47 | 48 | 49 | RTOS_SOURCE 50 | $%7BRTOS_ROOT%7D/FreeRTOS/Source 51 | 52 | 53 | RTOS_SOURCE_INCLUDE 54 | $%7BRTOS_ROOT%7D/FreeRTOS/Source/Include 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_MultiCore/.settings/Dependency_Scan_Preferences.prefs: -------------------------------------------------------------------------------- 1 | DependecyMode=ScanBuildDep 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_MultiCore/.settings/IORegisterSetting.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | IBDTAUD 5 | IBD 6 | IBDTAUD0 7 | IMR9 8 | IMR8 9 | IMR0 10 | IMR2 11 | IMR 12 | IMRTAU 13 | ICTAUD0I2 14 | 15 | 16 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_MultiCore/.settings/com.renesas.tools.misrac.prefs: -------------------------------------------------------------------------------- 1 | applyRule=Apply all rules 2 | eclipse.preferences.version=1 3 | exclusionRuleNumber= 4 | isMisracRuleCheck=false 5 | isUseCompilerSetting=false 6 | misra2004=true 7 | misra2012=false 8 | outputFormat=TXT Files (*.txt) 9 | ruleNumber= 10 | ruleNumberDescriptionFile= 11 | saveToFile=No save 12 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_MultiCore/.settings/e2studio_project.prefs: -------------------------------------------------------------------------------- 1 | # 2 | #Tue Jul 02 14:21:47 ICT 2024 3 | activeConfiguration=com.renesas.cdt.managedbuild.renesas.ccrh.hardwaredebug.configuration.1239971482 4 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_MultiCore/.settings/org.eclipse.cdt.core.prefs: -------------------------------------------------------------------------------- 1 | doxygen/doxygen_new_line_after_brief=true 2 | doxygen/doxygen_use_brief_tag=false 3 | doxygen/doxygen_use_javadoc_tags=true 4 | doxygen/doxygen_use_pre_tag=false 5 | doxygen/doxygen_use_structural_commands=false 6 | eclipse.preferences.version=1 7 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_MultiCore/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_MultiCore/.settings/org.eclipse.ltk.core.refactoring.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false 3 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_MultiCore/.settings/renesasPGModel.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | LITTLE 4 | 5 | 6 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_MultiCore/bsp/bsp_irq/bsp_irq.c: -------------------------------------------------------------------------------- 1 | #include "bsp_common.h" 2 | #include "FreeRTOS.h" 3 | 4 | extern irq_vector_t g_vector_table_PE1[ RTOS_VECTOR_TABLE_MAX_ENTRIES ]; 5 | extern irq_vector_t g_vector_table_PE2[ RTOS_VECTOR_TABLE_MAX_ENTRIES ]; 6 | 7 | 8 | void vCommonISRHandler( int irq ) 9 | { 10 | if( portGET_CORE_ID() == 0 ) 11 | { 12 | g_vector_table_PE1[ irq ](); 13 | } 14 | else if( portGET_CORE_ID() == 1 ) 15 | { 16 | g_vector_table_PE2[ irq ](); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_MultiCore/bsp/bsp_irq/bsp_irq.h: -------------------------------------------------------------------------------- 1 | #ifndef BSP_IRQ_BSP_IRQ_H_ 2 | #define BSP_IRQ_BSP_IRQ_H_ 3 | 4 | #define BSP_FE_VECTOR_TABLE_ENTRIES ( 32 ) 5 | #define BSP_EIC_VECTOR_TABLE_ENTRIES ( 377 ) 6 | #define BSP_VECTOR_TABLE_MAX_ENTRIES ( 409 ) 7 | 8 | typedef void (* irq_vector_t)( void ); 9 | 10 | void bsp_common_interrupt_handler( uint32_t id ); 11 | 12 | #endif /* BSP_IRQ_BSP_IRQ_H_ */ 13 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_MultiCore/bsp/bsp_irq/vector_data.c: -------------------------------------------------------------------------------- 1 | #include "bsp_common.h" 2 | #include "FreeRTOSConfig.h" 3 | 4 | typedef void (* int_vector_t)( void ); 5 | 6 | const irq_vector_t g_vector_table_PE1[ RTOS_VECTOR_TABLE_MAX_ENTRIES ] = 7 | { 8 | #if ( configNUMBER_OF_CORES > 1 ) 9 | [ 0 ] = vPortIPIHander, /* Internal processor interrupt 0 */ 10 | /* [8] = vCH0_TAUD0_Handler0, */ 11 | #endif 12 | /* [48] = TAUD0I1_Handler, */ 13 | /* [49] = TAUD0I3_Handler, */ 14 | [ 84 ] = vPortTickISR, /* ICOSTM0 (OSTM0 interrupt) */ 15 | }; 16 | 17 | /* Vector table allocations */ 18 | const irq_vector_t g_vector_table_PE2[ RTOS_VECTOR_TABLE_MAX_ENTRIES ] = 19 | { 20 | #if ( configNUMBER_OF_CORES > 1 ) 21 | [ 0 ] = vPortIPIHander, /* Internal processor interrupt 0 */ 22 | /* [9] = vCH2_TAUD0_Handler2 */ 23 | #else 24 | [ 0 ] = vDummyISR, 25 | #endif 26 | }; 27 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_MultiCore/bsp/bsp_irq/vector_data.h: -------------------------------------------------------------------------------- 1 | #ifndef BSP_IRQ_VECTOR_DATA_H_ 2 | #define BSP_IRQ_VECTOR_DATA_H_ 3 | 4 | 5 | #define RTOS_VECTOR_TABLE_MAX_ENTRIES ( 409 ) 6 | 7 | 8 | extern void vPortIPIHander( void ); 9 | extern void vPortTickISR( void ); 10 | 11 | extern void vDummyISR( void ); 12 | 13 | 14 | extern void TAUD0I1_Handler( void ); 15 | extern void TAUD0I3_Handler( void ); 16 | 17 | #endif /* BSP_IRQ_VECTOR_DATA_H_ */ 18 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_MultiCore/bsp/common/bsp_common.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMON_BSP_COMMON_H_ 2 | #define COMMON_COMMON_H_ 3 | 4 | #include 5 | #include "iodefine.h" 6 | #include "bsp_compiler_support.h" 7 | #include "bsp_macro.h" 8 | #include "../bsp_clock/bsp_clock.h" 9 | #include "../bsp_irq/bsp_irq.h" 10 | #include "../bsp_irq/vector_data.h" 11 | 12 | 13 | 14 | #endif /* COMMON_BSP_COMMON_H_ */ 15 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_MultiCore/bsp/common/bsp_macro.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************************************************** 2 | * DISCLAIMER 3 | * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. 4 | * No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all 5 | * applicable laws, including copyright laws. 6 | * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED 7 | * OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 8 | * NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY 9 | * LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT, 10 | * INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR 11 | * ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 12 | * Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability 13 | * of this software. By using this software, you agree to the additional terms and conditions found by accessing the 14 | * following link: 15 | * http://www.renesas.com/disclaimer 16 | * 17 | * Copyright (C) 2018 - 2024 Renesas Electronics Corporation. All rights reserved. 18 | ***********************************************************************************************************************/ 19 | 20 | #ifndef COMMON_BSP_MACRO_H_ 21 | #define COMMON_BSP_MACRO_H_ 22 | 23 | #define _WRITE_PROTECT_COMMAND ( 0x000000A5UL ) /* Write protected */ 24 | 25 | #endif /* COMMON_BSP_MACRO_H_ */ 26 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_MultiCore/src/RegTests.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202212.00 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | */ 26 | 27 | #ifndef REG_TEST_H 28 | #define REG_TEST_H 29 | 30 | void vStartRegisterTasks( UBaseType_t uxPriority ); 31 | BaseType_t xAreRegisterTasksStillRunning( void ); 32 | 33 | #endif /* REG_TEST_H */ 34 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_MultiCore/src/TestRunner.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202212.00 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | */ 26 | 27 | #ifndef TEST_RUNNER_H 28 | #define TEST_RUNNER_H 29 | 30 | /** 31 | * Start all the tests. 32 | * 33 | * Note that this function starts the scheduler and therefore, never returns. 34 | */ 35 | void vStartTests( void ); 36 | 37 | #endif /* TEST_RUNNER_H */ 38 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_MultiCore/src/main.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202212.00 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | */ 26 | 27 | #ifndef MAIN_H 28 | #define MAIN_H 29 | 30 | 31 | 32 | void main_blinky(); 33 | 34 | #endif /* MAIN_H */ 35 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_SingleCore/.gitignore: -------------------------------------------------------------------------------- 1 | /HardwareDebug 2 | *.rcpc 3 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_SingleCore/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | RH850_F1K_Single 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | 14 | 15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 16 | full,incremental, 17 | 18 | 19 | 20 | 21 | com.renesas.cdt.managedbuild.renesas.misrachecker.builder 22 | 23 | 24 | 25 | 26 | 27 | org.eclipse.cdt.core.cnature 28 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 29 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 30 | 31 | 32 | 33 | freertos/Common 34 | 2 35 | $%7BRTOS_ROOT%7D/FreeRTOS/Demo/Common 36 | 37 | 38 | freertos/freertos_kernel 39 | 2 40 | $%7BRTOS_SOURCE%7D 41 | 42 | 43 | 44 | 45 | RTOS_ROOT 46 | $%7BPARENT-6-PROJECT_LOC%7D 47 | 48 | 49 | RTOS_SOURCE 50 | $%7BRTOS_ROOT%7D/FreeRTOS/Source 51 | 52 | 53 | RTOS_SOURCE_INCLUDE 54 | $%7BRTOS_ROOT%7D/FreeRTOS/Source/Include 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_SingleCore/.settings/Dependency_Scan_Preferences.prefs: -------------------------------------------------------------------------------- 1 | DependecyMode=ScanBuildDep 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_SingleCore/.settings/IORegisterSetting.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | RESF 5 | 6 | 7 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_SingleCore/.settings/com.renesas.tools.misrac.prefs: -------------------------------------------------------------------------------- 1 | applyRule=Apply all rules 2 | eclipse.preferences.version=1 3 | exclusionRuleNumber= 4 | isMisracRuleCheck=false 5 | isUseCompilerSetting=false 6 | misra2004=true 7 | misra2012=false 8 | outputFormat=TXT Files (*.txt) 9 | ruleNumber= 10 | ruleNumberDescriptionFile= 11 | saveToFile=No save 12 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_SingleCore/.settings/e2studio_project.prefs: -------------------------------------------------------------------------------- 1 | # 2 | #Tue Jul 02 13:58:39 ICT 2024 3 | activeConfiguration=com.renesas.cdt.managedbuild.renesas.ccrh.hardwaredebug.configuration.1239971482 4 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_SingleCore/.settings/org.eclipse.cdt.core.prefs: -------------------------------------------------------------------------------- 1 | doxygen/doxygen_new_line_after_brief=true 2 | doxygen/doxygen_use_brief_tag=false 3 | doxygen/doxygen_use_javadoc_tags=true 4 | doxygen/doxygen_use_pre_tag=false 5 | doxygen/doxygen_use_structural_commands=false 6 | eclipse.preferences.version=1 7 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_SingleCore/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_SingleCore/.settings/org.eclipse.ltk.core.refactoring.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false 3 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_SingleCore/.settings/renesasPGModel.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | LITTLE 4 | 5 | 6 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_SingleCore/README.md: -------------------------------------------------------------------------------- 1 | # RH850 F1KM-S4 and F1KH-D8 FreeRTOS Community Supported Demo 2 | 3 | ## Introduction 4 | This directory contains demo project for Renesas RH850 F1KM-S4 and F1KH-D8 5 | 6 | This example implements the standard test demos detailed in following link: [RTOS Third Party Demo](https://github.com/FreeRTOS/FreeRTOS/blob/main/FreeRTOS/Demo/ThirdParty/Template/README.md) 7 | 8 | ## IDE 9 | - [E2Studio suport RH850 family](https://www.renesas.com/us/en/software-tool/e2studio-information-rh850-family) 10 | 11 | 12 | ## How to use 13 | Open e2studio and import this project File->Open Projects from File System 14 | 15 | In order to see log you can add your thread safe transmit function in here or use Dynamic printf feature supported by E2Studio. 16 | 17 | ```c 18 | int printf (const char * format, ...) 19 | { 20 | char tx_buff[100]; 21 | va_list arg; 22 | va_start(arg, format); 23 | vsprintf(tx_buff, format, arg); 24 | va_end(arg); 25 | 26 | /* Put your transmit function here */ 27 | 28 | return 0; 29 | } 30 | 31 | ``` 32 | 33 | Select the device you want to test by updating the macros `DEVICE_F1KH` or `DEVICE_F1KM` in `bsp\common\coldreset.asm`. 34 | 35 | Select the test case you want to run by changing the definition of `configSTART__TESTS` in the `freertos\FreeRTOSConfig.h` macros to `0` or `1` as needed. 36 | 37 | ## Linker 38 | 39 | This project also support other single core devices by changing the linker. 40 | 41 | **F1KH-D8** 42 | ```c 43 | RESET,RESET_PE1,RESET_PEn,STARTUP_CODE/0,ex_entry_PE1/800,.const,.INIT_BSEC.const,.INIT_DSEC.const,.data,.text/00002000,.stack.bss,.data.R,.bss/FEBD0000 44 | ``` 45 | 46 | **F1KM-S4** 47 | ```c 48 | RESET,RESET_PE1,RESET_PEn,STARTUP_CODE/0,ex_entry_PE1/800,.const,.INIT_BSEC.const,.INIT_DSEC.const,.data,.text/00002000,.stack.bss,.data.R,.bss/FEEE8000 49 | ``` 50 | 51 | For other devices please check memory maps and update the correspond address. 52 | 53 | 54 | ### Setting Linker 55 | ![Linker section](../Image//Linker.png) 56 | 57 | 58 | ## Note 59 | 1. The test case for `portYIELD_FROM_ISR` are out of scope. -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_SingleCore/bsp/bsp_irq/bsp_irq.c: -------------------------------------------------------------------------------- 1 | #include "bsp_common.h" 2 | 3 | extern irq_vector_t g_vector_table_PE1[ RTOS_VECTOR_TABLE_MAX_ENTRIES ]; 4 | extern irq_vector_t g_vector_table_PE2[ RTOS_VECTOR_TABLE_MAX_ENTRIES ]; 5 | 6 | 7 | void vCommonISRHandler( int irq ) 8 | { 9 | if( GetCoreID() == 0 ) 10 | { 11 | g_vector_table_PE1[ irq ](); 12 | } 13 | else if( GetCoreID() == 1 ) 14 | { 15 | g_vector_table_PE2[ irq ](); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_SingleCore/bsp/bsp_irq/bsp_irq.h: -------------------------------------------------------------------------------- 1 | #ifndef BSP_IRQ_BSP_IRQ_H_ 2 | #define BSP_IRQ_BSP_IRQ_H_ 3 | 4 | #define BSP_FE_VECTOR_TABLE_ENTRIES ( 32 ) 5 | #define BSP_EIC_VECTOR_TABLE_ENTRIES ( 377 ) 6 | #define BSP_VECTOR_TABLE_MAX_ENTRIES ( 409 ) 7 | 8 | typedef void (* irq_vector_t)( void ); 9 | 10 | void bsp_common_interrupt_handler( uint32_t id ); 11 | 12 | #endif /* BSP_IRQ_BSP_IRQ_H_ */ 13 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_SingleCore/bsp/bsp_irq/vector_data.c: -------------------------------------------------------------------------------- 1 | #include "bsp_common.h" 2 | #include "FreeRTOSConfig.h" 3 | 4 | typedef void (* int_vector_t)( void ); 5 | 6 | const irq_vector_t g_vector_table_PE1[ RTOS_VECTOR_TABLE_MAX_ENTRIES ] = 7 | { 8 | #if ( configNUMBER_OF_CORES > 1 ) 9 | [ 0 ] = vPortIPIHander, /* Internal processor interrupt 0 */ 10 | /* [8] = vCH0_TAUD0_Handler0, */ 11 | #endif 12 | /* [48] = TAUD0I1_Handler, */ 13 | /* [49] = TAUD0I3_Handler, */ 14 | [ 84 ] = vPortTickISR, /* ICOSTM0 (OSTM0 interrupt) */ 15 | }; 16 | 17 | /* Vector table allocations */ 18 | const irq_vector_t g_vector_table_PE2[ RTOS_VECTOR_TABLE_MAX_ENTRIES ] = 19 | { 20 | #if ( configNUMBER_OF_CORES > 1 ) 21 | [ 0 ] = vPortIPIHander, /* Internal processor interrupt 0 */ 22 | /* [9] = vCH2_TAUD0_Handler2 */ 23 | #else 24 | [ 0 ] = vDummyISR, 25 | #endif 26 | }; 27 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_SingleCore/bsp/bsp_irq/vector_data.h: -------------------------------------------------------------------------------- 1 | #ifndef BSP_IRQ_VECTOR_DATA_H_ 2 | #define BSP_IRQ_VECTOR_DATA_H_ 3 | 4 | 5 | #define RTOS_VECTOR_TABLE_MAX_ENTRIES ( 409 ) 6 | 7 | 8 | extern void vPortIPIHander( void ); 9 | extern void vPortTickISR( void ); 10 | 11 | extern void vDummyISR( void ); 12 | 13 | 14 | extern void TAUD0I1_Handler( void ); 15 | extern void TAUD0I3_Handler( void ); 16 | 17 | #endif /* BSP_IRQ_VECTOR_DATA_H_ */ 18 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_SingleCore/bsp/common/bsp_common.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMON_BSP_COMMON_H_ 2 | #define COMMON_COMMON_H_ 3 | 4 | #include 5 | #include "iodefine.h" 6 | #include "bsp_compiler_support.h" 7 | #include "bsp_macro.h" 8 | #include "../bsp_clock/bsp_clock.h" 9 | #include "../bsp_irq/bsp_irq.h" 10 | #include "../bsp_irq/vector_data.h" 11 | 12 | 13 | static inline int GetCoreID() 14 | { 15 | return( ( __stsr_rh( 0, 2 ) >> 16 ) - 1 ); 16 | } 17 | #endif /* COMMON_BSP_COMMON_H_ */ 18 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_SingleCore/bsp/common/bsp_macro.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************************************************** 2 | * DISCLAIMER 3 | * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. 4 | * No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all 5 | * applicable laws, including copyright laws. 6 | * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED 7 | * OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 8 | * NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY 9 | * LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT, 10 | * INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR 11 | * ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 12 | * Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability 13 | * of this software. By using this software, you agree to the additional terms and conditions found by accessing the 14 | * following link: 15 | * http://www.renesas.com/disclaimer 16 | * 17 | * Copyright (C) 2018 - 2024 Renesas Electronics Corporation. All rights reserved. 18 | ***********************************************************************************************************************/ 19 | 20 | 21 | #ifndef COMMON_BSP_MACRO_H_ 22 | #define COMMON_BSP_MACRO_H_ 23 | 24 | #define _WRITE_PROTECT_COMMAND ( 0x000000A5UL ) /* Write protected */ 25 | 26 | #endif /* COMMON_BSP_MACRO_H_ */ 27 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_SingleCore/freertos/note.txt: -------------------------------------------------------------------------------- 1 | F1KH 2 Core: 2 | RESET,RESET_PE1,RESET_PEn,STARTUP_CODE/0,ex_entry_PE1/800,ex_entry_PE2,.const,.INIT_BSEC.const,.INIT_DSEC.const,.data,.text/00002000,.stack_pe2.bss/FE9D0000,.stack.bss,.data.R,.bss/FEFB8000,.mev_address.bss/FFFEEC00,RESET_PE2/0800000 3 | F1KM 1 Core: 4 | RESET,RESET_PE1,RESET_PEn,STARTUP_CODE/0,ex_entry_PE1/800,.const,.INIT_BSEC.const,.INIT_DSEC.const,.data,.text/00002000,.stack.bss,.data.R,.bss/FEBD0000 -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_SingleCore/src/RegTests.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202212.00 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | */ 26 | 27 | #ifndef REG_TEST_H 28 | #define REG_TEST_H 29 | 30 | void vStartRegisterTasks( UBaseType_t uxPriority ); 31 | BaseType_t xAreRegisterTasksStillRunning( void ); 32 | 33 | #endif /* REG_TEST_H */ 34 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_SingleCore/src/TestRunner.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202212.00 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | */ 26 | 27 | #ifndef TEST_RUNNER_H 28 | #define TEST_RUNNER_H 29 | 30 | /** 31 | * Start all the tests. 32 | * 33 | * Note that this function starts the scheduler and therefore, never returns. 34 | */ 35 | void vStartTests( void ); 36 | 37 | #endif /* TEST_RUNNER_H */ 38 | -------------------------------------------------------------------------------- /RH850_F1Kx_CCRH/SMP_SingleCore/src/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "bsp_common.h" 6 | #include "FreeRTOS.h" 7 | #include "TestRunner.h" 8 | 9 | 10 | int main( void ); 11 | 12 | 13 | int main( void ) 14 | { 15 | bsp_clock_init(); 16 | printf( "Start of program\r\n" ); 17 | vStartTests(); 18 | 19 | return 0; 20 | } 21 | 22 | #if ( configNUMBER_OF_CORES > 1 ) 23 | int main_PE2( void ) 24 | { 25 | volatile uint32_t * pIPIRRegAddr; 26 | 27 | bsp_clock_init(); 28 | 29 | /* Configure interrupt for IPIR interrupt in secondary core to receive request from primary core 30 | * Primary core is the core which start scheduler. 31 | */ 32 | pIPIRRegAddr = ( volatile uint32_t * ) 0xFFFEEA00; 33 | *pIPIRRegAddr = 0x0f; 34 | 35 | /* setup_TAUD_CH2_FOR_PE2(); */ 36 | 37 | /* The interrupt may be disabled by default. Just enable it */ 38 | EI(); 39 | 40 | /* Do nothing. Loop to keep PE2 run */ 41 | while( 1 ) 42 | { 43 | } 44 | } 45 | #endif /* (configNUMBER_OF_CORES > 1) */ 46 | 47 | 48 | 49 | int printf( const char * format, 50 | ... ) 51 | { 52 | char tx_buff[ 100 ]; 53 | va_list arg; 54 | 55 | va_start( arg, format ); 56 | vsprintf( tx_buff, format, arg ); 57 | va_end( arg ); 58 | 59 | /* Put your transmit function here */ 60 | NOP(); 61 | 62 | memset( tx_buff, 0, 100 ); 63 | return 0; 64 | } 65 | 66 | 67 | void vDummyISR( void ) 68 | { 69 | while( 1 ) 70 | { 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/VERSION: -------------------------------------------------------------------------------- 1 | CSI-v1.7.2 2 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/board/smartl_e906_evb/board_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | 19 | /****************************************************************************** 20 | * @file board_init.c 21 | * @brief CSI Source File for board init 22 | * @version V1.0 23 | * @date 02. June 2017 24 | ******************************************************************************/ 25 | #include 26 | #include 27 | #include "drv_usart.h" 28 | #include "soc.h" 29 | #include 30 | #include 31 | #include "pin.h" 32 | 33 | extern usart_handle_t console_handle; 34 | extern void ioreuse_initial(void); 35 | 36 | extern int clock_timer_init(void); 37 | extern int clock_timer_start(void); 38 | 39 | void board_init(void) 40 | { 41 | int32_t ret = 0; 42 | /* init the console*/ 43 | clock_timer_init(); 44 | clock_timer_start(); 45 | 46 | console_handle = csi_usart_initialize(CONSOLE_IDX, NULL); 47 | /* config the UART */ 48 | ret = csi_usart_config(console_handle, 115200, USART_MODE_ASYNCHRONOUS, USART_PARITY_NONE, USART_STOP_BITS_1, USART_DATA_BITS_8); 49 | 50 | if (ret < 0) { 51 | return; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/board/smartl_e906_evb/include/test_kernel_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /****************************************************************************** 18 | * @file test_kernel_config.h 19 | * @brief head file for driver config 20 | * @version V1.0 21 | * @date 02. June 2017 22 | ******************************************************************************/ 23 | 24 | #ifndef _KERNEL_CONFIG_H_ 25 | #define _KERNEL_CONFIG_H_ 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | 31 | #define TEST_EVENT 32 | #define TEST_SEM 33 | #define TEST_MUTEX 34 | #define TEST_SOFTWARE_TIMER 35 | #define TEST_MSGQ 36 | #define TEST_TASK 37 | #define TEST_MEMPOOL 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/csi_driver/include/drv_irq.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | 19 | /****************************************************************************** 20 | * @file drv_irq.h 21 | * @brief header File for IRQ Driver 22 | * @version V1.0 23 | * @date 21. Dec 2018 24 | * @model irq 25 | ******************************************************************************/ 26 | 27 | #include 28 | 29 | /** 30 | \brief enable irq. 31 | \param[in] irq_num Number of IRQ. 32 | \return None. 33 | */ 34 | void drv_irq_enable(uint32_t irq_num); 35 | 36 | /** 37 | \brief disable irq. 38 | \param[in] irq_num Number of IRQ. 39 | \return None. 40 | */ 41 | void drv_irq_disable(uint32_t irq_num); 42 | 43 | /** 44 | \brief register irq handler. 45 | \param[in] irq_num Number of IRQ. 46 | \param[in] irq_handler IRQ Handler. 47 | \return None. 48 | */ 49 | void drv_irq_register(uint32_t irq_num, void *irq_handler); 50 | 51 | /** 52 | \brief unregister irq handler. 53 | \param[in] irq_num Number of IRQ. 54 | \param[in] irq_handler IRQ Handler. 55 | \return None. 56 | */ 57 | void drv_irq_unregister(uint32_t irq_num); 58 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/csi_driver/smartl_rv32/include/pin_name.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | 19 | /****************************************************************************** 20 | * @file pin_name.h 21 | * @brief header file for the pin_name 22 | * @version V1.0 23 | * @date 02. June 2017 24 | ******************************************************************************/ 25 | #ifndef _PINNAMES_H 26 | #define _PINNAMES_H 27 | 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | 34 | typedef enum { 35 | PA0 = 0, 36 | PA1, 37 | PA2, 38 | PA3, 39 | PA4, 40 | PA5, 41 | PA6, 42 | PA7, 43 | PAD_UART0_SIN, 44 | PAD_UART0_SOUT 45 | } 46 | pin_name_e; 47 | 48 | typedef enum { 49 | PORTA = 0, 50 | PORTB = 1, 51 | PORTC = 2, 52 | PORTD = 3, 53 | PORTE = 4, 54 | PORTF = 5, 55 | PORTG = 6, 56 | PORTH = 7 57 | } port_name_e; 58 | 59 | typedef enum { 60 | NONE = 0 61 | } pin_func_e; 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/csi_driver/smartl_rv32/include/pinmux.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | 19 | /****************************************************************************** 20 | * @file pinmux.h 21 | * @brief Header file for the pinmux 22 | * @version V1.0 23 | * @date 02. June 2017 24 | ******************************************************************************/ 25 | 26 | #ifndef _PINMUX_H_ 27 | #define _PINMUX_H_ 28 | 29 | #include 30 | #include "pin_name.h" 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | int32_t drv_pinmux_config(pin_name_e pin, pin_func_e pin_func); 37 | 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif /* _PINMUX_H_ */ 44 | 45 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/csi_driver/smartl_rv32/include/sys_freq.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | /****************************************************************************** 19 | * @file sys_freq.h 20 | * @brief header file for setting system frequency. 21 | * @version V1.0 22 | * @date 18. July 2018 23 | ******************************************************************************/ 24 | #ifndef _SYS_FREQ_H_ 25 | #define _SYS_FREQ_H_ 26 | 27 | #include 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | int32_t drv_get_i2s_freq(int32_t idx); 34 | int32_t drv_get_pwm_freq(int32_t idx); 35 | int32_t drv_get_usart_freq(int32_t idx); 36 | int32_t drv_get_usi_freq(int32_t idx); 37 | int32_t drv_get_sys_freq(void); 38 | int32_t drv_get_apb_freq(void); 39 | int32_t drv_get_rtc_freq(int32_t idx); 40 | int32_t drv_get_timer_freq(int32_t idx); 41 | 42 | int32_t drv_get_cpu_freq(int32_t idx); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif /* _SYS_FREQ_H_ */ 49 | 50 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/csi_driver/smartl_rv32/lib.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | 19 | /****************************************************************************** 20 | * @file lib.c 21 | * @brief source file for the lib 22 | * @version V1.0 23 | * @date 02. June 2017 24 | ******************************************************************************/ 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include "soc.h" 30 | #include "csi_core.h" //for test 31 | #include "drv_usart.h" 32 | 33 | extern uint32_t csi_coret_get_load(void); 34 | extern uint32_t csi_coret_get_value(void); 35 | extern uint32_t csi_coret_get_valueh(void); 36 | 37 | extern int32_t csi_usart_putchar(usart_handle_t handle, uint8_t ch); 38 | extern int32_t csi_usart_getchar(usart_handle_t handle, uint8_t *ch); 39 | 40 | static void _mdelay(void) 41 | { 42 | unsigned long long start, cur, delta; 43 | uint32_t startl = csi_coret_get_value(); 44 | uint32_t starth = csi_coret_get_valueh(); 45 | uint32_t curl, curh; 46 | uint32_t cnt = (drv_get_sys_freq() / 1000); 47 | start = ((unsigned long long)starth << 32) | startl; 48 | 49 | while (1) { 50 | curl = csi_coret_get_value(); 51 | curh = csi_coret_get_valueh(); 52 | cur = ((unsigned long long)curh << 32) | curl; 53 | delta = cur - start; 54 | 55 | if (delta >= cnt) { 56 | return; 57 | } 58 | } 59 | } 60 | 61 | void mdelay(uint32_t ms) 62 | { 63 | if (ms == 0) { 64 | return; 65 | } 66 | 67 | while (ms--) { 68 | _mdelay(); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/csi_driver/smartl_rv32/novic_irq_tbl.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 YunOS Project. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | extern void Default_Handler(void); 21 | extern void CORET_IRQHandler(void); 22 | extern void TIM4_NMIHandler(void); 23 | 24 | void (*g_irqvector[48])(void); 25 | void (*g_nmivector)(void); 26 | 27 | void irq_vectors_init(void) 28 | { 29 | int i; 30 | 31 | for (i = 0; i < 48; i++) { 32 | g_irqvector[i] = Default_Handler; 33 | } 34 | 35 | g_irqvector[CORET_IRQn] = CORET_IRQHandler; 36 | g_nmivector = TIM4_NMIHandler; 37 | } 38 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/csi_driver/smartl_rv32/pinmux.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | 19 | /****************************************************************************** 20 | * @file pinmux.c 21 | * @brief source file for the pinmux 22 | * @version V1.0 23 | * @date 02. June 2017 24 | ******************************************************************************/ 25 | #include 26 | #include "pinmux.h" 27 | #include "pin_name.h" 28 | #include 29 | 30 | int32_t drv_pinmux_config(pin_name_e pin, pin_func_e pin_func) 31 | { 32 | return 0; 33 | } 34 | 35 | int32_t drv_pin_config_mode(port_name_e port, uint8_t offset, gpio_mode_e pin_mode) 36 | { 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/csi_driver/smartl_rv32/sys_freq.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | /****************************************************************************** 19 | * @file sys_freq.c 20 | * @brief source file for setting system frequency. 21 | * @version V1.0 22 | * @date 18. July 2018 23 | ******************************************************************************/ 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | extern int g_system_clock; 30 | 31 | int32_t drv_get_cpu_freq(int32_t idx) 32 | { 33 | return g_system_clock; 34 | } 35 | 36 | int32_t drv_get_usi_freq(int32_t idx) 37 | { 38 | return g_system_clock; 39 | } 40 | 41 | int32_t drv_get_usart_freq(int32_t idx) 42 | { 43 | return g_system_clock; 44 | } 45 | 46 | int32_t drv_get_pwm_freq(int32_t idx) 47 | { 48 | return g_system_clock; 49 | } 50 | 51 | int32_t drv_get_i2s_freq(int32_t idx) 52 | { 53 | return g_system_clock; 54 | } 55 | 56 | int32_t drv_get_sys_freq(void) 57 | { 58 | return g_system_clock; 59 | } 60 | 61 | int32_t drv_get_rtc_freq(int32_t idx) 62 | { 63 | return g_system_clock; 64 | } 65 | 66 | int32_t drv_get_apb_freq(void) 67 | { 68 | return g_system_clock; 69 | } 70 | 71 | int32_t drv_get_timer_freq(int32_t idx) 72 | { 73 | return g_system_clock; 74 | } 75 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/csi_driver/smartl_rv32/trap_c.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | /****************************************************************************** 19 | * @file trap_c.c 20 | * @brief source file for the trap process 21 | * @version V1.0 22 | * @date 12. December 2017 23 | ******************************************************************************/ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | void (*trap_c_callback)(void); 32 | 33 | void trap_c(uint32_t *regs) 34 | { 35 | int i; 36 | uint32_t vec = 0; 37 | 38 | vec = __get_MCAUSE() & 0x3FF; 39 | 40 | printf("CPU Exception: NO.%d", vec); 41 | printf("\n"); 42 | 43 | for (i = 0; i < 31; i++) { 44 | printf("x%d: %08x\t", i + 1, regs[i]); 45 | 46 | if ((i % 4) == 3) { 47 | printf("\n"); 48 | } 49 | } 50 | 51 | printf("\n"); 52 | printf("mepc : %08x\n", regs[31]); 53 | printf("mstatus: %08x\n", regs[32]); 54 | 55 | if (trap_c_callback) { 56 | trap_c_callback(); 57 | } 58 | 59 | while (1); 60 | } 61 | 62 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/libs/include/ringbuffer/ringbuffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | /****************************************************************************** 19 | * @file ringbuffer.h 20 | * @brief header file for ringbuffer Driver 21 | * @version V1.0 22 | * @date August 15. 2019 23 | ******************************************************************************/ 24 | #ifndef _RING_BUFFER_H_ 25 | #define _RING_BUFFER_H_ 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | #include "stdint.h" 32 | #include 33 | 34 | typedef struct ringbuffer { 35 | uint8_t *buffer; 36 | uint32_t size; 37 | uint32_t write; 38 | uint32_t read; 39 | uint32_t data_len; 40 | } ringbuffer_t; 41 | 42 | void ringbuffer_reset(ringbuffer_t *fifo); 43 | uint32_t ringbuffer_len(ringbuffer_t *fifo); 44 | uint32_t ringbuffer_avail(ringbuffer_t *fifo); 45 | bool ringbuffer_is_empty(ringbuffer_t *fifo); 46 | bool ringbuffer_is_full(ringbuffer_t *fifo); 47 | 48 | /*write to ringbuffer*/ 49 | uint32_t ringbuffer_in(ringbuffer_t *fifo, const void *in, uint32_t len); 50 | 51 | /*read to ringbuffer*/ 52 | uint32_t ringbuffer_out(ringbuffer_t *fifo, void *out, uint32_t len); 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif /* _RING_BUFFER_H_ */ 59 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/libs/include/sys/_stdint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | 19 | #ifndef _PRIV_STDINT_H_ 20 | #define _PRIV_STDINT_H_ 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | 26 | /* For newlib and minilibc utint32_t are not same */ 27 | #undef _UINT32_T_DECLARED 28 | #define _UINT32_T_DECLARED 29 | typedef unsigned int uint32_t; 30 | 31 | #undef _INT32_T_DECLARED 32 | #define _INT32_T_DECLARED 33 | typedef signed int int32_t; 34 | 35 | #include_next 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/libs/libc/_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /****************************************************************************** 18 | * @file _init.c 19 | * @brief source file for c++ init & uninit 20 | * @version V1.0 21 | * @date 24. April 2019 22 | ******************************************************************************/ 23 | 24 | #include 25 | #include 26 | 27 | #ifndef CPP_WEAK 28 | #define CPP_WEAK __attribute__((weak)) 29 | #endif 30 | 31 | extern int __dtor_end__; 32 | extern int __ctor_end__; 33 | extern int __ctor_start__; 34 | 35 | typedef void (*func_ptr) (void); 36 | 37 | CPP_WEAK void _init(void) 38 | { 39 | func_ptr *p; 40 | for (p = (func_ptr *)&__ctor_end__ - 1; p >= (func_ptr *)&__ctor_start__; p--) { 41 | (*p) (); 42 | } 43 | } 44 | 45 | CPP_WEAK void _fini(void) 46 | { 47 | func_ptr *p; 48 | for (p = (func_ptr *)&__ctor_end__; p <= (func_ptr *)&__dtor_end__ - 1; p++) { 49 | (*p) (); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/libs/libc/minilibc_port.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | 19 | /****************************************************************************** 20 | * @file minilibc_port.c 21 | * @brief minilibc port 22 | * @version V1.0 23 | * @date 26. Dec 2017 24 | ******************************************************************************/ 25 | 26 | #include 27 | #include 28 | #ifndef CONFIG_KERNEL_NONE 29 | #include 30 | #endif 31 | 32 | #include 33 | 34 | usart_handle_t console_handle = NULL; 35 | 36 | __attribute__((weak)) int write(int __fd, __const void *__buf, int __n) 37 | { 38 | return 0; 39 | } 40 | 41 | int fputc(int ch, FILE *stream) 42 | { 43 | (void)stream; 44 | 45 | if (console_handle == NULL) { 46 | return -1; 47 | } 48 | 49 | if (ch == '\n') { 50 | csi_usart_putchar(console_handle, '\r'); 51 | } 52 | 53 | csi_usart_putchar(console_handle, ch); 54 | 55 | return 0; 56 | } 57 | 58 | int fgetc(FILE *stream) 59 | { 60 | uint8_t ch; 61 | (void)stream; 62 | 63 | if (console_handle == NULL) { 64 | return -1; 65 | } 66 | 67 | csi_usart_getchar(console_handle, &ch); 68 | 69 | return ch; 70 | } 71 | 72 | int os_critical_enter(unsigned int *lock) 73 | { 74 | (void)lock; 75 | #ifndef CONFIG_KERNEL_NONE 76 | csi_kernel_sched_suspend(); 77 | #endif 78 | 79 | return 0; 80 | } 81 | 82 | int os_critical_exit(unsigned int *lock) 83 | { 84 | (void)lock; 85 | #ifndef CONFIG_KERNEL_NONE 86 | csi_kernel_sched_resume(0); 87 | #endif 88 | 89 | return 0; 90 | } 91 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/libs/mm/lib_mallinfo.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 YunOS Project. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include "mm.h" 19 | #include "umm_heap.h" 20 | #include 21 | 22 | int32_t mm_get_mallinfo(int32_t *total, int32_t *used, int32_t *free, int32_t *peak) 23 | { 24 | struct mallinfo info; 25 | mm_mallinfo(USR_HEAP, &info); 26 | *total = info.arena; 27 | *used = info.uordblks; 28 | *free = info.fordblks; 29 | #if (CONFIG_MM_MAX_USED) 30 | *peak = mm_get_max_usedsize(); 31 | #endif 32 | return 0; 33 | } 34 | 35 | 36 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/libs/syslog/syslog.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /****************************************************************************** 18 | * @file syslog.c 19 | * @brief Syslog const strings and APIs 20 | * @version V1.0 21 | * @date 29. January 2019 22 | ******************************************************************************/ 23 | #include 24 | 25 | #define LOG_COLOR_RED_YELLO_BACK "\033[1;31;43m" 26 | #define LOG_COLOR_RED "\033[2;31;49m" 27 | #define LOG_COLOR_YELLOW "\033[2;33;49m" 28 | #define LOG_COLOR_GREEN "\033[2;32;49m" 29 | #define LOG_COLOR_BLUE "\033[2;34;49m" 30 | #define LOG_COLOR_GRAY "\033[1;30m" 31 | #define LOG_COLOR_WHITE "\033[2;47;49m" 32 | #define LOG_COLOR_RESET "\033[0m" 33 | 34 | #ifdef CONFIG_SYSLOG_COLORFUL 35 | const char *PFORMAT_D = LOG_COLOR_GRAY "[D][%s():%d] " LOG_COLOR_RESET; 36 | const char *PFORMAT_I = LOG_COLOR_WHITE "[I][%s():%d] " LOG_COLOR_RESET; 37 | const char *PFORMAT_W = LOG_COLOR_YELLOW "[W][%s():%d] " LOG_COLOR_RESET; 38 | const char *PFORMAT_E = LOG_COLOR_RED "[E][%s():%d] " LOG_COLOR_RESET; 39 | #else 40 | const char *PFORMAT_D = "[D][%s():%d] "; 41 | const char *PFORMAT_I = "[I][%s():%d] "; 42 | const char *PFORMAT_W = "[W][%s():%d] "; 43 | const char *PFORMAT_E = "[E][%s():%d] "; 44 | #endif 45 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/projects/event/freertos/configs/csi_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CSI_CONFIG_H__ 18 | #define __CSI_CONFIG_H__ 19 | #define CONFIG_ARCH_RV32 1 20 | #define CONFIG_CPU_E906FD 1 21 | #define CONFIG_RV32_CORETIM 1 22 | #define CONFIG_CHIP_SMARTL_RV32 1 23 | #define CONFIG_BOARD_SMARTL_E906_EVB 1 24 | #define CONFIG_BOARD_NAME_STR "smartl_e906_evb" 25 | #define CONFIG_KERNEL_FREERTOS 1 26 | #define CONFIG_SUPPORT_TSPEND 1 27 | #define CONFIG_ARCH_INTERRUPTSTACK 4096 28 | #define CONFIG_NEWLIB_WRAP 1 29 | #define CONFIG_USER_DEFINED_LD_DIR_STR "" 30 | #endif 31 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/projects/event/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | 19 | /****************************************************************************** 20 | * @file main.c 21 | * @brief CSI Source File for main 22 | * @version V1.0 23 | * @date 02. June 2017 24 | ******************************************************************************/ 25 | 26 | #include 27 | #include 28 | 29 | #define K_API_PARENT_PRIO 5 30 | #define APP_START_TASK_STK_SIZE 1024 31 | 32 | extern void example_main(void); 33 | 34 | k_task_handle_t example_main_task; 35 | 36 | int main(void) 37 | { 38 | csi_kernel_init(); 39 | 40 | csi_kernel_task_new((k_task_entry_t)example_main, "example_main", 41 | 0, K_API_PARENT_PRIO, 0, 0, APP_START_TASK_STK_SIZE, &example_main_task); 42 | 43 | csi_kernel_start(); 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/projects/event/test_kernel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | 19 | /****************************************************************************** 20 | * @file test_kernel.h 21 | * @brief header file for the kernel test 22 | * @version V1.0 23 | * @date 02. June 2017 24 | ******************************************************************************/ 25 | #include 26 | #include 27 | 28 | #define testTRUE 1 29 | #define testFALSE 0 30 | #define TASK_TIME_QUANTA 100 //you can change time_quanta through modifing configTICK_RATE_HZ. 31 | #define TEST_TASK_STACK_SIZE 1024 32 | #define WAIT_FOREVER 0xffffffff 33 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/projects/message_q/freertos/configs/csi_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CSI_CONFIG_H__ 18 | #define __CSI_CONFIG_H__ 19 | #define CONFIG_ARCH_RV32 1 20 | #define CONFIG_CPU_E906FD 1 21 | #define CONFIG_RV32_CORETIM 1 22 | #define CONFIG_CHIP_SMARTL_RV32 1 23 | #define CONFIG_BOARD_SMARTL_E906_EVB 1 24 | #define CONFIG_BOARD_NAME_STR "smartl_e906_evb" 25 | #define CONFIG_KERNEL_FREERTOS 1 26 | #define CONFIG_SUPPORT_TSPEND 1 27 | #define CONFIG_ARCH_INTERRUPTSTACK 4096 28 | #define CONFIG_NEWLIB_WRAP 1 29 | #define CONFIG_USER_DEFINED_LD_DIR_STR "" 30 | #endif 31 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/projects/message_q/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | 19 | /****************************************************************************** 20 | * @file main.c 21 | * @brief CSI Source File for main 22 | * @version V1.0 23 | * @date 02. June 2017 24 | ******************************************************************************/ 25 | 26 | #include 27 | #include 28 | 29 | #define K_API_PARENT_PRIO 5 30 | #define APP_START_TASK_STK_SIZE 1024 31 | 32 | extern void example_main(void); 33 | 34 | k_task_handle_t example_main_task; 35 | 36 | int main(void) 37 | { 38 | csi_kernel_init(); 39 | 40 | csi_kernel_task_new((k_task_entry_t)example_main, "example_main", 41 | 0, K_API_PARENT_PRIO, 0, 0, APP_START_TASK_STK_SIZE, &example_main_task); 42 | 43 | csi_kernel_start(); 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/projects/message_q/test_kernel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | 19 | /****************************************************************************** 20 | * @file test_kernel.h 21 | * @brief header file for the kernel test 22 | * @version V1.0 23 | * @date 02. June 2017 24 | ******************************************************************************/ 25 | #include 26 | #include 27 | 28 | #define testTRUE 1 29 | #define testFALSE 0 30 | #define TASK_TIME_QUANTA 100 //you can change time_quanta through modifing configTICK_RATE_HZ. 31 | #define TEST_TASK_STACK_SIZE 1024 32 | #define WAIT_FOREVER 0xffffffff 33 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/projects/mutex/freertos/configs/csi_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CSI_CONFIG_H__ 18 | #define __CSI_CONFIG_H__ 19 | #define CONFIG_ARCH_RV32 1 20 | #define CONFIG_CPU_E906FD 1 21 | #define CONFIG_RV32_CORETIM 1 22 | #define CONFIG_CHIP_SMARTL_RV32 1 23 | #define CONFIG_BOARD_SMARTL_E906_EVB 1 24 | #define CONFIG_BOARD_NAME_STR "smartl_e906_evb" 25 | #define CONFIG_KERNEL_FREERTOS 1 26 | #define CONFIG_SUPPORT_TSPEND 1 27 | #define CONFIG_ARCH_INTERRUPTSTACK 4096 28 | #define CONFIG_NEWLIB_WRAP 1 29 | #define CONFIG_USER_DEFINED_LD_DIR_STR "" 30 | #endif 31 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/projects/mutex/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | /****************************************************************************** 19 | * @file main.c 20 | * @brief CSI Source File for main 21 | * @version V1.0 22 | * @date 02. June 2017 23 | ******************************************************************************/ 24 | 25 | #include 26 | #include 27 | 28 | #define K_API_PARENT_PRIO 5 29 | #define APP_START_TASK_STK_SIZE 1024 30 | 31 | extern void example_main(void); 32 | 33 | k_task_handle_t example_main_task; 34 | 35 | int main(void) 36 | { 37 | csi_kernel_init(); 38 | 39 | csi_kernel_task_new((k_task_entry_t)example_main, "example_main", 40 | 0, K_API_PARENT_PRIO, 0, 0, APP_START_TASK_STK_SIZE, &example_main_task); 41 | 42 | csi_kernel_start(); 43 | 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/projects/mutex/test_kernel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | /****************************************************************************** 19 | * @file test_kernel.h 20 | * @brief header file for the kernel test 21 | * @version V1.0 22 | * @date 02. June 2017 23 | ******************************************************************************/ 24 | #include 25 | #include 26 | 27 | #define testTRUE 1 28 | #define testFALSE 0 29 | #define TASK_TIME_QUANTA 100 //you can change time_quanta through modifing configTICK_RATE_HZ. 30 | #define TEST_TASK_STACK_SIZE 1024 31 | #define WAIT_FOREVER 0xffffffff 32 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/projects/sem/freertos/configs/csi_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CSI_CONFIG_H__ 18 | #define __CSI_CONFIG_H__ 19 | #define CONFIG_ARCH_RV32 1 20 | #define CONFIG_CPU_E906FD 1 21 | #define CONFIG_RV32_CORETIM 1 22 | #define CONFIG_CHIP_SMARTL_RV32 1 23 | #define CONFIG_BOARD_SMARTL_E906_EVB 1 24 | #define CONFIG_BOARD_NAME_STR "smartl_e906_evb" 25 | #define CONFIG_KERNEL_FREERTOS 1 26 | #define CONFIG_SUPPORT_TSPEND 1 27 | #define CONFIG_ARCH_INTERRUPTSTACK 4096 28 | #define CONFIG_NEWLIB_WRAP 1 29 | #define CONFIG_USER_DEFINED_LD_DIR_STR "" 30 | #endif 31 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/projects/sem/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | 19 | /****************************************************************************** 20 | * @file main.c 21 | * @brief CSI Source File for main 22 | * @version V1.0 23 | * @date 02. June 2017 24 | ******************************************************************************/ 25 | 26 | #include 27 | #include 28 | 29 | #define K_API_PARENT_PRIO 5 30 | #define APP_START_TASK_STK_SIZE 1024 31 | 32 | extern void example_main(void); 33 | 34 | k_task_handle_t example_main_task; 35 | 36 | int main(void) 37 | { 38 | csi_kernel_init(); 39 | 40 | csi_kernel_task_new((k_task_entry_t)example_main, "example_main", 41 | 0, K_API_PARENT_PRIO, 0, 0, APP_START_TASK_STK_SIZE, &example_main_task); 42 | 43 | csi_kernel_start(); 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/projects/sem/test_kernel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | /****************************************************************************** 19 | * @file test_kernel.h 20 | * @brief header file for the kernel test 21 | * @version V1.0 22 | * @date 02. June 2017 23 | ******************************************************************************/ 24 | #include 25 | #include 26 | 27 | #define testTRUE 1 28 | #define testFALSE 0 29 | #define TASK_TIME_QUANTA 100 //you can change time_quanta through modifing configTICK_RATE_HZ. 30 | #define TEST_TASK_STACK_SIZE 1024 31 | #define WAIT_FOREVER 0xffffffff 32 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/projects/task/freertos/configs/csi_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CSI_CONFIG_H__ 18 | #define __CSI_CONFIG_H__ 19 | #define CONFIG_ARCH_RV32 1 20 | #define CONFIG_CPU_E906FD 1 21 | #define CONFIG_RV32_CORETIM 1 22 | #define CONFIG_CHIP_SMARTL_RV32 1 23 | #define CONFIG_BOARD_SMARTL_E906_EVB 1 24 | #define CONFIG_BOARD_NAME_STR "smartl_e906_evb" 25 | #define CONFIG_KERNEL_FREERTOS 1 26 | #define CONFIG_SUPPORT_TSPEND 1 27 | #define CONFIG_ARCH_INTERRUPTSTACK 4096 28 | #define CONFIG_NEWLIB_WRAP 1 29 | #define CONFIG_USER_DEFINED_LD_DIR_STR "" 30 | #endif 31 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/projects/task/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | 19 | /****************************************************************************** 20 | * @file main.c 21 | * @brief CSI Source File for main 22 | * @version V1.0 23 | * @date 02. June 2017 24 | ******************************************************************************/ 25 | 26 | #include 27 | #include 28 | 29 | #define K_API_PARENT_PRIO 5 30 | #define APP_START_TASK_STK_SIZE 1024 31 | 32 | extern void example_main(void); 33 | 34 | k_task_handle_t example_main_task; 35 | 36 | int main(void) 37 | { 38 | csi_kernel_init(); 39 | 40 | csi_kernel_task_new((k_task_entry_t)example_main, "example_main", 41 | 0, K_API_PARENT_PRIO, 0, 0, APP_START_TASK_STK_SIZE, &example_main_task); 42 | 43 | csi_kernel_start(); 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/projects/task/test_kernel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | 19 | /****************************************************************************** 20 | * @file test_kernel.h 21 | * @brief header file for the kernel test 22 | * @version V1.0 23 | * @date 02. June 2017 24 | ******************************************************************************/ 25 | #include 26 | #include 27 | 28 | #define testTRUE 1 29 | #define testFALSE 0 30 | #define TASK_TIME_QUANTA 100 //you can change time_quanta through modifing configTICK_RATE_HZ. 31 | #define TEST_TASK_STACK_SIZE 1024 32 | #define WAIT_FOREVER 0xffffffff 33 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/projects/time/freertos/configs/csi_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CSI_CONFIG_H__ 18 | #define __CSI_CONFIG_H__ 19 | #define CONFIG_ARCH_RV32 1 20 | #define CONFIG_CPU_E906FD 1 21 | #define CONFIG_RV32_CORETIM 1 22 | #define CONFIG_CHIP_SMARTL_RV32 1 23 | #define CONFIG_BOARD_SMARTL_E906_EVB 1 24 | #define CONFIG_BOARD_NAME_STR "smartl_e906_evb" 25 | #define CONFIG_KERNEL_FREERTOS 1 26 | #define CONFIG_SUPPORT_TSPEND 1 27 | #define CONFIG_ARCH_INTERRUPTSTACK 4096 28 | #define CONFIG_NEWLIB_WRAP 1 29 | #define CONFIG_USER_DEFINED_LD_DIR_STR "" 30 | #endif 31 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/projects/time/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | 19 | /****************************************************************************** 20 | * @file main.c 21 | * @brief CSI Source File for main 22 | * @version V1.0 23 | * @date 02. June 2017 24 | ******************************************************************************/ 25 | 26 | #include 27 | #include 28 | 29 | #define K_API_PARENT_PRIO 5 30 | #define APP_START_TASK_STK_SIZE 1024 31 | 32 | extern void example_main(void); 33 | 34 | k_task_handle_t example_main_task; 35 | 36 | int main(void) 37 | { 38 | csi_kernel_init(); 39 | 40 | csi_kernel_task_new((k_task_entry_t)example_main, "example_main", 41 | 0, K_API_PARENT_PRIO, 0, 0, APP_START_TASK_STK_SIZE, &example_main_task); 42 | 43 | csi_kernel_start(); 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/projects/time/test_kernel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | 19 | /****************************************************************************** 20 | * @file test_kernel.h 21 | * @brief header file for the kernel test 22 | * @version V1.0 23 | * @date 02. June 2017 24 | ******************************************************************************/ 25 | #include 26 | #include 27 | 28 | #define testTRUE 1 29 | #define testFALSE 0 30 | #define TASK_TIME_QUANTA 100 //you can change time_quanta through modifing configTICK_RATE_HZ. 31 | #define TEST_TASK_STACK_SIZE 1024 32 | #define WAIT_FOREVER 0xffffffff 33 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/projects/time/time_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited 3 | */ 4 | 5 | 6 | /****************************************************************************** 7 | * @file time_test.c 8 | * @brief the main function for the time test 9 | * @version V1.0 10 | * @date 02. June 2017 11 | ******************************************************************************/ 12 | #include "test_kernel.h" 13 | #include 14 | #include 15 | 16 | extern k_task_handle_t k_api_example_arr[]; 17 | 18 | void example_k_TransformTime(void) 19 | { 20 | uint64_t uwMs; 21 | uint64_t uwTick; 22 | uwTick = csi_kernel_ms2tick(10000); 23 | printf("10000 ms to Tick = %llu \n", uwTick); 24 | uwMs = csi_kernel_tick2ms(100); 25 | printf("100 tick to ms = %llu \n", uwMs); 26 | 27 | csi_kernel_task_del(csi_kernel_task_get_cur()); 28 | } 29 | 30 | void example_main(void) 31 | { 32 | uint64_t uwTickCount = 0; 33 | uint32_t cnt; 34 | 35 | cnt = 10; 36 | printf("print cnt every 1s for %u times\n", cnt); 37 | 38 | while (cnt--) { 39 | uwTickCount += 100; 40 | csi_kernel_delay(100); 41 | printf("-----%u\n", cnt); 42 | } 43 | 44 | cnt = 3; 45 | printf("print cnt every 3s for %u times\n", cnt); 46 | 47 | while (cnt--) { 48 | uwTickCount += 300; 49 | csi_kernel_delay(300); 50 | printf("-----%u\n", cnt); 51 | } 52 | 53 | csi_kernel_delay(200); 54 | uwTickCount = csi_kernel_get_ticks(); 55 | 56 | if (0 != uwTickCount) { 57 | printf("csi_kernel_get_ticks = %u \n", (uint32_t)uwTickCount); 58 | } 59 | 60 | csi_kernel_delay(200); 61 | uwTickCount = csi_kernel_get_ticks(); 62 | 63 | if (0 != uwTickCount) { 64 | printf("csi_kernel_get_ticks after delay = %u \n", (uint32_t)uwTickCount); 65 | } 66 | 67 | printf("test kernel time successfully!\n"); 68 | csi_kernel_task_del(csi_kernel_task_get_cur()); 69 | } 70 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/projects/timer/freertos/configs/csi_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CSI_CONFIG_H__ 18 | #define __CSI_CONFIG_H__ 19 | #define CONFIG_ARCH_RV32 1 20 | #define CONFIG_CPU_E906FD 1 21 | #define CONFIG_RV32_CORETIM 1 22 | #define CONFIG_CHIP_SMARTL_RV32 1 23 | #define CONFIG_BOARD_SMARTL_E906_EVB 1 24 | #define CONFIG_BOARD_NAME_STR "smartl_e906_evb" 25 | #define CONFIG_KERNEL_FREERTOS 1 26 | #define CONFIG_SUPPORT_TSPEND 1 27 | #define CONFIG_ARCH_INTERRUPTSTACK 4096 28 | #define CONFIG_NEWLIB_WRAP 1 29 | #define CONFIG_USER_DEFINED_LD_DIR_STR "" 30 | #endif 31 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/projects/timer/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | 19 | /****************************************************************************** 20 | * @file main.c 21 | * @brief CSI Source File for main 22 | * @version V1.0 23 | * @date 02. June 2017 24 | ******************************************************************************/ 25 | 26 | #include 27 | #include 28 | 29 | #define K_API_PARENT_PRIO 5 30 | #define APP_START_TASK_STK_SIZE 1024 31 | 32 | extern void example_main(void); 33 | 34 | k_task_handle_t example_main_task; 35 | 36 | int main(void) 37 | { 38 | csi_kernel_init(); 39 | 40 | csi_kernel_task_new((k_task_entry_t)example_main, "example_main", 41 | 0, K_API_PARENT_PRIO, 0, 0, APP_START_TASK_STK_SIZE, &example_main_task); 42 | 43 | csi_kernel_start(); 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/projects/timer/test_kernel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017-2019 Alibaba Group Holding Limited. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | 19 | /****************************************************************************** 20 | * @file test_kernel.h 21 | * @brief header file for the kernel test 22 | * @version V1.0 23 | * @date 02. June 2017 24 | ******************************************************************************/ 25 | #include 26 | #include 27 | 28 | #define testTRUE 1 29 | #define testFALSE 0 30 | #define TASK_TIME_QUANTA 100 //you can change time_quanta through modifing configTICK_RATE_HZ. 31 | #define TEST_TASK_STACK_SIZE 1024 32 | #define WAIT_FOREVER 0xffffffff 33 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/utilities/aft_build.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeRTOS/FreeRTOS-Community-Supported-Demos/b3c0438523378449c4190d1e5f673ab2583c17aa/RISC-V_RV32_THEAD_SMART_CDS/utilities/aft_build.sh -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/utilities/flash.init: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeRTOS/FreeRTOS-Community-Supported-Demos/b3c0438523378449c4190d1e5f673ab2583c17aa/RISC-V_RV32_THEAD_SMART_CDS/utilities/flash.init -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/utilities/gdb-qemu.init: -------------------------------------------------------------------------------- 1 | set architecture riscv:rv32 2 | tar rem:8809 3 | 4 | #b freertos_risc_v_trap_handler 5 | b *0x00004006 6 | #b Default_IRQHandler 7 | b *0x0 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /RISC-V_RV32_THEAD_SMART_CDS/utilities/gdb.init: -------------------------------------------------------------------------------- 1 | target remote 172.16.201.64:1025 2 | set *(int *)0x0=0x6f 3 | si 4 | reset 5 | set *(int *)0x40011008=0x0 6 | set *(int *)0x4001101c=0x0 7 | 8 | b Default_Handler 9 | lo 10 | -------------------------------------------------------------------------------- /Renesas-RISC-V-MCU_llvm/src/Demo/Common/common.c: -------------------------------------------------------------------------------- 1 | #include "FreeRTOS.h" 2 | #include "task.h" 3 | #include "r_smc_entry.h" 4 | #include "stdio.h" 5 | #include "stdarg.h" 6 | #include "assert.h" 7 | 8 | volatile bool g_vcoms_tx_done = true; 9 | 10 | //void vAssertCalled() 11 | //{ 12 | // /* Stop execution for debugging purposes or log the error */ 13 | // for( ;; ); 14 | //} 15 | 16 | void vAssertCalled(const char *pcFileName, unsigned long ulLine) { 17 | /* Stop execution for debugging purposes or log the error */ 18 | for ( ;; ); 19 | } 20 | 21 | void vApplicationStackOverflowHook( TaskHandle_t xTask, char *pcTaskName ) 22 | { 23 | /* Stop execution for debugging purposes or log the error */ 24 | for( ;; ); 25 | } 26 | 27 | void vApplicationMallocFailedHook() { 28 | /* Stop execution for debugging purposes or log the error */ 29 | for( ;; ); 30 | } 31 | 32 | void vApplicationIdleHook() { 33 | } 34 | 35 | void freertos_risc_v_application_interrupt_handler(void) { 36 | 37 | } 38 | 39 | void freertos_risc_v_application_exception_handler(void) { 40 | 41 | } 42 | 43 | void machine_timer_enable(void) { 44 | R_CPU_AUX->MACTCR_b.ENABLE = 1U; 45 | R_CLIC->clicintie7_b.IE = 1U; /* enable mtip interrupt */ 46 | } 47 | 48 | void vcom_printf( char const * format, ...) 49 | { 50 | va_list args; 51 | MD_STATUS err; 52 | uint8_t tx_data[256]; 53 | int len = 0; 54 | 55 | while (!g_vcoms_tx_done); // Wait for last write to complete 56 | 57 | va_start(args, format); 58 | len = vsprintf((char *)tx_data, format, args); 59 | err = R_Config_UART0_Send(tx_data, (uint16_t) len); 60 | 61 | assert (err == MD_OK); 62 | g_vcoms_tx_done = false; 63 | 64 | va_end(args); 65 | } 66 | -------------------------------------------------------------------------------- /Renesas-RISC-V-MCU_llvm/src/Demo/Common/common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * common.h 3 | * 4 | * Created on: 14 Oct 2024 5 | * Author: Pole 6 | */ 7 | 8 | #ifndef DEMO_COMMON_COMMON_H_ 9 | #define DEMO_COMMON_COMMON_H_ 10 | 11 | #define printf vcom_printf 12 | 13 | void vcom_printf( char const * format, ...); 14 | void machine_timer_enable(void); 15 | 16 | #endif /* DEMO_COMMON_COMMON_H_ */ 17 | -------------------------------------------------------------------------------- /Renesas-RISC-V-MCU_llvm/src/Demo/IntQueueTimer.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202212.00 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. If you wish to use our Amazon 14 | * FreeRTOS name, please do so in a fair use way that does not cause confusion. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | * https://www.FreeRTOS.org 24 | * https://github.com/FreeRTOS 25 | * 26 | */ 27 | 28 | /* Scheduler includes. */ 29 | #include "FreeRTOS.h" 30 | #include "task.h" 31 | 32 | /* Demo includes. */ 33 | #include "IntQueueTimer.h" 34 | #include "IntQueue.h" 35 | 36 | /*-----------------------------------------------------------*/ 37 | 38 | void vInitialiseTimerForIntQueueTest( void ) 39 | { 40 | /* Initialize a hardware timer. */ 41 | } 42 | /*-----------------------------------------------------------*/ 43 | 44 | void IntQueueTestTimerHandler( void ) 45 | { 46 | portYIELD_FROM_ISR( xSecondTimerHandler() ); 47 | } 48 | /*-----------------------------------------------------------*/ 49 | -------------------------------------------------------------------------------- /Renesas-RISC-V-MCU_llvm/src/Demo/IntQueueTimer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202212.00 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. If you wish to use our Amazon 14 | * FreeRTOS name, please do so in a fair use way that does not cause confusion. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | * https://www.FreeRTOS.org 24 | * https://github.com/FreeRTOS 25 | * 26 | */ 27 | 28 | #ifndef INT_QUEUE_TIMER_H 29 | #define INT_QUEUE_TIMER_H 30 | 31 | /** 32 | * The function called from queue interrupt tests to initialise timer. 33 | */ 34 | void vInitialiseTimerForIntQueueTest( void ); 35 | 36 | /** 37 | * The function to be called from a timer handler. 38 | */ 39 | void IntQueueTestTimerHandler( void ); 40 | 41 | #endif /* INT_QUEUE_TIMER_H */ 42 | -------------------------------------------------------------------------------- /Renesas-RISC-V-MCU_llvm/src/Demo/RegTests.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202212.00 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | */ 26 | 27 | #ifndef REG_TEST_H 28 | #define REG_TEST_H 29 | 30 | void vStartRegisterTasks( UBaseType_t uxPriority ); 31 | BaseType_t xAreRegisterTasksStillRunning( void ); 32 | 33 | #endif /* REG_TEST_H */ 34 | -------------------------------------------------------------------------------- /Renesas-RISC-V-MCU_llvm/src/Demo/TestRunner.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS V202212.00 3 | * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * https://www.FreeRTOS.org 23 | * https://github.com/FreeRTOS 24 | * 25 | */ 26 | 27 | #ifndef TEST_RUNNER_H 28 | #define TEST_RUNNER_H 29 | 30 | /** 31 | * Start all the tests. 32 | * 33 | * Note that this function starts the scheduler and therefore, never returns. 34 | */ 35 | void vStartTests( void ); 36 | 37 | #endif /* TEST_RUNNER_H */ 38 | -------------------------------------------------------------------------------- /Renesas-RISC-V-MCU_llvm/src/Demo/main.c: -------------------------------------------------------------------------------- 1 | #include "r_smc_entry.h" 2 | #include "TestRunner.h" 3 | #include "common.h" 4 | 5 | int main(void); 6 | 7 | int main(void) 8 | { 9 | /* Startup and Hardware initialization. */ 10 | machine_timer_enable(); 11 | 12 | R_Config_UART0_Create(); 13 | R_Config_UART0_Start(); 14 | 15 | printf("Starting...\n\r"); 16 | 17 | /* Start tests. */ 18 | vStartTests(); 19 | 20 | /* Should never reach here. */ 21 | for (;;); 22 | 23 | return 0; 24 | } 25 | 26 | -------------------------------------------------------------------------------- /Renesas-RISC-V-MCU_llvm/src/smc_gen/r_bsp/doc/en/r01an7177ej0122-risc-v-mcu-bsp.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeRTOS/FreeRTOS-Community-Supported-Demos/b3c0438523378449c4190d1e5f673ab2583c17aa/Renesas-RISC-V-MCU_llvm/src/smc_gen/r_bsp/doc/en/r01an7177ej0122-risc-v-mcu-bsp.pdf -------------------------------------------------------------------------------- /Renesas-RISC-V-MCU_llvm/src/smc_gen/r_bsp/readme.txt: -------------------------------------------------------------------------------- 1 | Version : BSP v1.22 2 | Release Date : 2024/09/17 3 | Support Compiler : LLVM, ICCRISCV, SEGGER 4 | 5 | 6 | -------------------------------------------------------------------------------- /XCORE.AI_xClang/.gitignore: -------------------------------------------------------------------------------- 1 | /.metadata/ 2 | 3 | **/.build*/* 4 | **/bin/* 5 | *.o 6 | *.xe 7 | *.vcd 8 | *.s 9 | *.xi 10 | *.i 11 | *.a 12 | *.xmt 13 | **/_build/ 14 | **/run_*.log 15 | **/pdf/* 16 | **/html/* 17 | **/.settings/* 18 | *.pyc 19 | **/test_results.csv 20 | **/.venv/** 21 | # systemview debug files 22 | *.SVDAT 23 | 24 | -------------------------------------------------------------------------------- /XCORE.AI_xClang/RTOSDemo/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | bin 3 | *.d -------------------------------------------------------------------------------- /XCORE.AI_xClang/RTOSDemo/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | RTOSDemo 4 | 5 | 6 | 7 | 8 | 9 | com.xmos.cdt.core.ModulePathBuilder 10 | 11 | 12 | 13 | 14 | com.xmos.cdt.core.ProjectInfoSyncBuilder 15 | 16 | 17 | 18 | 19 | com.xmos.cdt.core.LegacyProjectCheckerBuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 25 | clean,full,incremental, 26 | 27 | 28 | 29 | 30 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 31 | full,incremental, 32 | 33 | 34 | 35 | 36 | 37 | org.eclipse.cdt.core.cnature 38 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 39 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 40 | com.xmos.cdt.core.XdeProjectNature 41 | 42 | 43 | 44 | Common 45 | 2 46 | $%7BPARENT-3-PROJECT_LOC%7D/Demo/Common 47 | 48 | 49 | freertos 50 | 2 51 | $%7BPARENT-3-PROJECT_LOC%7D/Source 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /XCORE.AI_xClang/RTOSDemo/src/IntQueueTimer/IntQueueTimer.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020, XMOS Ltd, All rights reserved 2 | 3 | #include "FreeRTOS.h" 4 | #include "task.h" 5 | 6 | #include 7 | #include 8 | 9 | #include "IntQueue.h" 10 | 11 | DEFINE_RTOS_INTERRUPT_CALLBACK( pxIntQueueTimerISR, pvData ) 12 | { 13 | static int xCount0, xCount1; 14 | hwtimer_t xTimer = ( hwtimer_t ) pvData; 15 | uint32_t ulNow; 16 | int xYieldRequired; 17 | 18 | ulNow = hwtimer_get_time( xTimer ); 19 | ulNow = hwtimer_get_trigger_time( xTimer ); 20 | ulNow += configCPU_CLOCK_HZ / 50; 21 | 22 | if( ++xCount0 == 2 ) 23 | { 24 | xCount0 = 0; 25 | taskENTER_CRITICAL_FROM_ISR(); 26 | if( xFirstTimerHandler() != pdFALSE ) 27 | { 28 | xYieldRequired = pdTRUE; 29 | } 30 | taskEXIT_CRITICAL_FROM_ISR( 0 ); 31 | } 32 | 33 | if( ++xCount1 == 3 ) 34 | { 35 | xCount1 = 0; 36 | taskENTER_CRITICAL_FROM_ISR(); 37 | if( xSecondTimerHandler() != pdFALSE ) 38 | { 39 | xYieldRequired = pdTRUE; 40 | } 41 | taskEXIT_CRITICAL_FROM_ISR( 0 ); 42 | } 43 | 44 | hwtimer_change_trigger_time( xTimer, ulNow ); 45 | 46 | portYIELD_FROM_ISR( xYieldRequired ); 47 | } 48 | 49 | void vInitialiseTimerForIntQueueTest( void ) 50 | { 51 | uint32_t ulNow; 52 | uint32_t ulState; 53 | hwtimer_t xIntQueueTimer; 54 | 55 | /* 56 | * Disable interrupts here so we stay on the same core 57 | */ 58 | ulState = portDISABLE_INTERRUPTS(); 59 | { 60 | xIntQueueTimer = hwtimer_alloc(); 61 | ulNow = hwtimer_get_time( xIntQueueTimer ); 62 | ulNow += configCPU_CLOCK_HZ / 50; 63 | triggerable_setup_interrupt_callback( xIntQueueTimer, ( void * ) xIntQueueTimer, RTOS_INTERRUPT_CALLBACK( pxIntQueueTimerISR ) ); 64 | hwtimer_set_trigger_time( xIntQueueTimer, ulNow ); 65 | triggerable_enable_trigger( xIntQueueTimer ); 66 | } 67 | portRESTORE_INTERRUPTS( ulState ); 68 | } 69 | 70 | -------------------------------------------------------------------------------- /XCORE.AI_xClang/RTOSDemo/src/IntQueueTimer/IntQueueTimer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020, XMOS Ltd, All rights reserved 2 | 3 | #ifndef INTQUEUETIMER_H_ 4 | #define INTQUEUETIMER_H_ 5 | 6 | void vInitialiseTimerForIntQueueTest( void ); 7 | 8 | #endif /* INTQUEUETIMER_H_ */ 9 | -------------------------------------------------------------------------------- /XCORE.AI_xClang/RTOSDemo/src/config.xscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /XCORE.AI_xClang/RTOSDemo/src/main.xc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019, XMOS Ltd, All rights reserved 2 | 3 | #include 4 | 5 | #include "rtos_printf.h" 6 | #include "testing_main.h" 7 | 8 | extern "C" { 9 | int c_main( int tile, chanend xTile0Chan, chanend xTile1Chan, chanend xTile2Chan, chanend xTile3Chan ); 10 | } 11 | 12 | void xctask1(void) 13 | { 14 | rtos_printf("xc task 1 on core %u\n", get_logical_core_id()); 15 | for (;;); 16 | } 17 | 18 | void xctask2(void) 19 | { 20 | rtos_printf("xc task 2 on core %u\n", get_logical_core_id()); 21 | for (;;); 22 | } 23 | 24 | int main(void) 25 | { 26 | chan c_t0_t1; 27 | 28 | par { 29 | on tile[0]: 30 | { 31 | par { 32 | #if ( testingmainENABLE_XC_TASKS == 1 ) 33 | xctask1(); 34 | #endif 35 | c_main( 0, null, c_t0_t1, null, null ); 36 | } 37 | } 38 | #if ( testingmainNUM_TILES > 1 ) 39 | on tile[1]: 40 | { 41 | par { 42 | #if ( testingmainENABLE_XC_TASKS == 1 ) 43 | xctask2(); 44 | #endif 45 | c_main( 1, c_t0_t1, null, null, null ); 46 | } 47 | } 48 | #endif 49 | } 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /XCORE.AI_xClang/RTOSDemo/src/partest/mab_led_driver.xc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020, XMOS Ltd, All rights reserved 2 | 3 | #include 4 | #include 5 | 6 | out port p_led_0_4 = PORT_LEDS; 7 | 8 | #define MAX(a,b) ((a) > (b) ? (a) : (b)) 9 | 10 | #define LED_COUNT 4 11 | 12 | void led_driver(uint16_t led_value) 13 | { 14 | p_led_0_4 <: 0; 15 | p_led_0_4 <: (unsigned)( led_value & 0x000F ); 16 | } 17 | -------------------------------------------------------------------------------- /XCORE.AI_xClang/RTOSDemo/src/regtest/regtest.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020, XMOS Ltd, All rights reserved 2 | 3 | #ifndef REGTEST_H_ 4 | #define REGTEST_H_ 5 | 6 | void vStartRegTestTasks( UBaseType_t uxPriority ); 7 | BaseType_t xAreRegTestTasksStillRunning( void ); 8 | 9 | /* These functions load known values into all general purpose registers 10 | and verify that their integrity remains intact. 11 | If this function ever returns, register values were unexpectedly changed */ 12 | void prvRegisterCheck_asm1( void ); 13 | void prvRegisterCheck_asm2( void ); 14 | 15 | #endif /* REGTEST_H_ */ 16 | -------------------------------------------------------------------------------- /XCORE.AI_xClang/lib_rtos_support/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | lib_rtos_support 4 | 5 | 6 | lib_xcore_c 7 | FreeRTOS 8 | 9 | 10 | 11 | com.xmos.cdt.core.ProjectInfoSyncBuilder 12 | 13 | 14 | 15 | 16 | com.xmos.cdt.core.ModulePathBuilder 17 | 18 | 19 | 20 | 21 | com.xmos.cdt.core.LegacyProjectCheckerBuilder 22 | 23 | 24 | 25 | 26 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 27 | 28 | 29 | 30 | 31 | 32 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 33 | full,incremental, 34 | 35 | 36 | 37 | 38 | 39 | org.eclipse.cdt.core.cnature 40 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 41 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 42 | com.xmos.cdt.core.XdeProjectNature 43 | 44 | 45 | -------------------------------------------------------------------------------- /XCORE.AI_xClang/lib_rtos_support/api/rtos_cores.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2021 XMOS LIMITED. 2 | // This Software is subject to the terms of the XMOS Public Licence: Version 1. 3 | 4 | #ifndef RTOS_CORES_H_ 5 | #define RTOS_CORES_H_ 6 | 7 | /* The maximum number of cores an SMP RTOS may use */ 8 | #define RTOS_MAX_CORE_COUNT 8 9 | 10 | #if __XC__ 11 | extern "C" { 12 | #endif //__XC__ 13 | 14 | /** 15 | * The RTOS must call this once for each core it 16 | * starts its scheduler on. 17 | * 18 | * \returns the ID of the core it is called on 19 | */ 20 | int rtos_core_register(void); 21 | 22 | /** 23 | * Returns the ID of the calling core. 24 | * 25 | * rtos_core_register() must have been previously 26 | * called on the calling core. 27 | * 28 | * \returns the ID of the calling core. 29 | */ 30 | int rtos_core_id_get(void); 31 | 32 | /** 33 | * Translates an RTOS core ID into the logical "xcore" 34 | * core ID. 35 | * 36 | * \param core_id An RTOS core ID 37 | * 38 | * \returns the logical "xcore" core ID 39 | */ 40 | int rtos_logical_core_id_get(int core_id); 41 | 42 | /** 43 | * Returns the number of cores the RTOS is currently 44 | * running on. 45 | * 46 | * \returns the number of cores the RTOS is running on. 47 | */ 48 | int rtos_core_count(void); 49 | 50 | #ifdef __XC__ 51 | } 52 | #endif //__XC__ 53 | 54 | #endif /* RTOS_CORES_H_ */ 55 | -------------------------------------------------------------------------------- /XCORE.AI_xClang/lib_rtos_support/api/rtos_locks.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2021 XMOS LIMITED. 2 | // This Software is subject to the terms of the XMOS Public Licence: Version 1. 3 | 4 | #ifndef RTOS_LOCKS_H_ 5 | #define RTOS_LOCKS_H_ 6 | 7 | #if !defined(__XC__) 8 | 9 | #include "rtos_support_rtos_config.h" 10 | #include 11 | #include 12 | 13 | #ifndef RTOS_LOCK_COUNT 14 | #error You must define RTOS_LOCK_COUNT in rtos_support_rtos_config.h 15 | #endif 16 | 17 | #if RTOS_LOCK_COUNT == 0 18 | /* If the RTOS does not need any locks 19 | * that is fine, but the IRQ functions still 20 | * need one. */ 21 | #undef RTOS_LOCK_COUNT 22 | #define RTOS_LOCK_COUNT 1 23 | #endif 24 | 25 | #if RTOS_LOCK_COUNT > 4 26 | #error XCORE does not support more than 4 hardware locks 27 | #endif 28 | 29 | void rtos_locks_initialize(void); 30 | 31 | inline int rtos_lock_acquire(int lock_id) 32 | { 33 | extern lock_t rtos_locks[RTOS_LOCK_COUNT]; 34 | extern int rtos_lock_counters[RTOS_LOCK_COUNT]; 35 | 36 | xassert(lock_id >= 0 && lock_id < RTOS_LOCK_COUNT); 37 | if (rtos_locks[lock_id] != -1) { 38 | lock_acquire(rtos_locks[lock_id]); 39 | rtos_lock_counters[lock_id]++; 40 | } 41 | 42 | return rtos_lock_counters[lock_id]; 43 | } 44 | 45 | /** 46 | * 47 | * \warning Be careful not to release a lock that the calling 48 | * core does not own or else bad things will happen. 49 | * Defining RTOS_LOCKS_SAFE to 1 will enable a check 50 | * to see the lock is owned. If it is not it will 51 | * throw an exception. 52 | */ 53 | inline int rtos_lock_release(int lock_id) 54 | { 55 | extern lock_t rtos_locks[RTOS_LOCK_COUNT]; 56 | extern int rtos_lock_counters[RTOS_LOCK_COUNT]; 57 | int counter = 0; 58 | 59 | xassert(lock_id >= 0 && lock_id < RTOS_LOCK_COUNT); 60 | if (rtos_locks[lock_id] != -1) { 61 | #if RTOS_LOCKS_SAFE 62 | lock_acquire(rtos_locks[lock_id]); 63 | xassert(rtos_lock_counters[lock_id] > 0); 64 | #endif 65 | counter = --rtos_lock_counters[lock_id]; 66 | if (counter == 0) { 67 | lock_release(rtos_locks[lock_id]); 68 | } 69 | } 70 | 71 | return counter; 72 | } 73 | 74 | #endif // !defined(__XC__) 75 | 76 | #endif /* RTOS_LOCKS_H_ */ 77 | -------------------------------------------------------------------------------- /XCORE.AI_xClang/lib_rtos_support/api/rtos_macros.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2021 XMOS LIMITED. 2 | // This Software is subject to the terms of the XMOS Public Licence: Version 1. 3 | 4 | #ifndef RTOS_MACROS_H_ 5 | #define RTOS_MACROS_H_ 6 | 7 | #include "rtos_support_rtos_config.h" 8 | 9 | #define RTOS_STRINGIFY_I(...) #__VA_ARGS__ 10 | #define RTOS_STRINGIFY(...) RTOS_STRINGIFY_I(__VA_ARGS__) 11 | 12 | /* 13 | * Inserts a compile time memory barrier 14 | */ 15 | #define RTOS_MEMORY_BARRIER() asm volatile( "" ::: "memory" ) 16 | 17 | /* 18 | * Returns the number of 32-bit stack words required by the given thread entry function. 19 | * 20 | * This will not just "work" if there is any recursion or function pointers in the thread. 21 | * For function pointers the fptrgroup attribute may be used. For recursive functions, the 22 | * "stackfunction" #pragma may be used. 23 | * 24 | * Example FreeRTOS usage: 25 | * xTaskCreate( vTask, "task_name", RTOS_THREAD_STACK_SIZE(vTask), pvParameters, uxPriority, &pxTaskHandle ); 26 | */ 27 | #define RTOS_THREAD_STACK_SIZE(thread_entry) \ 28 | ({ \ 29 | uint32_t stack_size; \ 30 | asm volatile ( \ 31 | "ldc %0, " RTOS_STRINGIFY(thread_entry) ".nstackwords + " RTOS_STRINGIFY(RTOS_SUPPORT_INTERRUPT_STACK_GROWTH) "\n\t" \ 32 | : "=r"(stack_size) /* output 0 is stack_size */ \ 33 | : /* there are no inputs */ \ 34 | : /* nothing gets clobbered */ \ 35 | ); \ 36 | stack_size; \ 37 | }) 38 | 39 | #endif /* RTOS_MACROS_H_ */ 40 | -------------------------------------------------------------------------------- /XCORE.AI_xClang/lib_rtos_support/api/rtos_support.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2021 XMOS LIMITED. 2 | // This Software is subject to the terms of the XMOS Public Licence: Version 1. 3 | 4 | #ifndef RTOS_SUPPORT_H_ 5 | #define RTOS_SUPPORT_H_ 6 | 7 | /* Config file to be provided by the RTOS */ 8 | #include "rtos_support_rtos_config.h" 9 | 10 | /* Library header files */ 11 | #include "rtos_cores.h" 12 | #include "rtos_interrupt.h" 13 | #include "rtos_locks.h" 14 | #include "rtos_time.h" 15 | #include "rtos_macros.h" 16 | #include "rtos_printf.h" 17 | 18 | #ifndef __XC__ 19 | #include "rtos_irq.h" 20 | #endif 21 | 22 | #endif /* RTOS_SUPPORT_H_ */ 23 | -------------------------------------------------------------------------------- /XCORE.AI_xClang/lib_rtos_support/module_build_info: -------------------------------------------------------------------------------- 1 | VERSION = 0.5.0 2 | 3 | DEPENDENT_MODULES = 4 | 5 | MODULE_XCC_FLAGS = $(XCC_FLAGS) -Os 6 | 7 | OPTIONAL_HEADERS += rtos_support_conf.h 8 | 9 | EXPORT_INCLUDE_DIRS = api src 10 | 11 | INCLUDE_DIRS = $(EXPORT_INCLUDE_DIRS) 12 | 13 | SOURCE_DIRS = src 14 | -------------------------------------------------------------------------------- /XCORE.AI_xClang/lib_rtos_support/src/rtos_cores.c: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2021 XMOS LIMITED. 2 | // This Software is subject to the terms of the XMOS Public Licence: Version 1. 3 | 4 | #include 5 | 6 | #include "rtos_support.h" 7 | 8 | /* 9 | * This is indexed by the logical core ID 10 | * returned by get_logical_core_id(). 11 | * It returns the RTOS core ID which is 12 | * guaranteed to be between 0 and the number of 13 | * cores used by the RTOS - 1. 14 | * 15 | * Not static so that it can be accessed directly by 16 | * RTOS functions written in assembly. 17 | */ 18 | int rtos_core_map[RTOS_MAX_CORE_COUNT] = {0}; 19 | 20 | /* 21 | * This is indexed by the RTOS core ID 22 | * which must be between 0 and the number of 23 | * cores used by the RTOS - 1. 24 | * It returns the logical core ID which is 25 | * returned by get_logical_core_id(). 26 | */ 27 | static int rtos_core_map_reverse[RTOS_MAX_CORE_COUNT]; 28 | 29 | /* 30 | * The number of RTOS cores that have been initialized. 31 | * 32 | * TODO: I don't think this needs to be volatile anymore 33 | * since it is only read through rtos_core_count(), which 34 | * should always read the value in memory. 35 | */ 36 | static /*volatile*/ int rtos_core_init_count; 37 | 38 | /* 39 | * Registers a new RTOS core. Returns its core ID. 40 | * Note this is not the necessarily the same as the 41 | * ID returned by get_logical_core_id(). 42 | */ 43 | int rtos_core_register(void) 44 | { 45 | int core_id; 46 | 47 | core_id = (int) get_logical_core_id(); 48 | 49 | rtos_lock_acquire(0); 50 | { 51 | rtos_core_map[core_id] = rtos_core_init_count; 52 | rtos_core_map_reverse[rtos_core_init_count] = core_id; 53 | core_id = rtos_core_init_count++; 54 | } 55 | rtos_lock_release(0); 56 | 57 | return core_id; 58 | } 59 | 60 | /* Note, always returns 0 before the scheduler is started. */ 61 | int rtos_core_id_get(void) 62 | { 63 | return rtos_core_map[get_logical_core_id()]; 64 | } 65 | 66 | int rtos_logical_core_id_get(int core_id) 67 | { 68 | xassert(core_id < rtos_core_init_count); 69 | return rtos_core_map_reverse[ core_id ]; 70 | } 71 | 72 | int rtos_core_count(void) 73 | { 74 | return rtos_core_init_count; 75 | } 76 | -------------------------------------------------------------------------------- /XCORE.AI_xClang/lib_rtos_support/src/rtos_interrupt.c: -------------------------------------------------------------------------------- 1 | // Copyright 2021 XMOS LIMITED. 2 | // This Software is subject to the terms of the XMOS Public Licence: Version 1. 3 | 4 | #include "rtos_support.h" 5 | 6 | /* 7 | * Ensure that these normally inline functions exist 8 | * when compiler optimizations are disabled. 9 | */ 10 | extern inline uint32_t rtos_interrupt_mask_get(void); 11 | extern inline uint32_t rtos_interrupt_mask_all(void); 12 | extern inline void rtos_interrupt_unmask_all(void); 13 | extern inline void rtos_interrupt_mask_set(uint32_t mask); 14 | extern inline uint32_t rtos_isr_running(void); 15 | -------------------------------------------------------------------------------- /XCORE.AI_xClang/lib_rtos_support/src/rtos_locks.c: -------------------------------------------------------------------------------- 1 | // Copyright 2019-2021 XMOS LIMITED. 2 | // This Software is subject to the terms of the XMOS Public Licence: Version 1. 3 | 4 | #include "rtos_support.h" 5 | 6 | lock_t rtos_locks[RTOS_LOCK_COUNT] = { 7 | #if RTOS_LOCK_COUNT >= 1 8 | -1, 9 | #endif 10 | #if RTOS_LOCK_COUNT >= 2 11 | -1, 12 | #endif 13 | #if RTOS_LOCK_COUNT >= 3 14 | -1, 15 | #endif 16 | #if RTOS_LOCK_COUNT >= 4 17 | -1 18 | #endif 19 | }; 20 | 21 | int rtos_lock_counters[RTOS_LOCK_COUNT] = {0}; 22 | 23 | void rtos_locks_initialize(void) 24 | { 25 | int i; 26 | 27 | for (i = 0; i < RTOS_LOCK_COUNT; i++) { 28 | rtos_locks[i] = lock_alloc(); 29 | xassert(rtos_locks[i] != 0); 30 | } 31 | } 32 | 33 | /* 34 | * Ensure that these normally inline functions exist 35 | * when compiler optimizations are disabled. 36 | */ 37 | extern inline int rtos_lock_acquire(int lock_id); 38 | extern inline int rtos_lock_release(int lock_id); 39 | -------------------------------------------------------------------------------- /XCORE.AI_xClang/lib_rtos_support/src/rtos_time.c: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2021 XMOS LIMITED. 2 | // This Software is subject to the terms of the XMOS Public Licence: Version 1. 3 | 4 | #include "rtos_time.h" 5 | #include "rtos_locks.h" 6 | 7 | static rtos_time_t current_time; 8 | 9 | #define US_FRACTIONAL_BITS 12 10 | #define ONE_SECOND_US (1000000 << US_FRACTIONAL_BITS) 11 | 12 | void rtos_time_increment(uint32_t tick_period) 13 | { 14 | rtos_lock_acquire(0); 15 | { 16 | current_time.microseconds += tick_period; 17 | if (current_time.microseconds >= ONE_SECOND_US) { 18 | current_time.microseconds -= ONE_SECOND_US; 19 | current_time.seconds++; 20 | } 21 | } 22 | rtos_lock_release(0); 23 | } 24 | 25 | void rtos_time_set(rtos_time_t new_time) 26 | { 27 | new_time.microseconds <<= US_FRACTIONAL_BITS; 28 | 29 | rtos_lock_acquire(0); 30 | { 31 | current_time = new_time; 32 | } 33 | rtos_lock_release(0); 34 | } 35 | 36 | rtos_time_t rtos_time_get(void) 37 | { 38 | rtos_time_t tmp_time; 39 | 40 | rtos_lock_acquire(0); 41 | { 42 | tmp_time = current_time; 43 | } 44 | rtos_lock_release(0); 45 | 46 | tmp_time.microseconds >>= US_FRACTIONAL_BITS; 47 | 48 | return tmp_time; 49 | } 50 | -------------------------------------------------------------------------------- /shakti/README: -------------------------------------------------------------------------------- 1 | steps run demo applications 2 | =========================== 3 | 4 | 1. git clone https://github.com/FreeRTOS/FreeRTOS.git --recurse-submodules 5 | 6 | 2. Please ensure, you installed the risc-v toolchain and exported them to 'PATH' variable. 7 | Please refer documentation section in https://shakti.org.in/sp2020-shakti.html for more details. 8 | https://shakti.org.in/docs/shakti-soc-user-manual.pdf has the steps to setup the board, install tool-chain and write applications. 9 | 10 | Demo for vajra SoC 11 | ================== 12 | Read the temperature and pressure from the surrounding environment. Store the value in internal SPI flash. 13 | Based on the temperature, decide to control Fan and Air conditioner. 14 | 15 | GPIO0 - Control to AC 16 | GPIO7 - Control to Full Fan rotation. 17 | GPIO8 - Control to Half Speed Fan rotation. 18 | 19 | Connections of the BMP280 sensor: 20 | 21 | VCC to 3.3V 22 | GND to GND 23 | SCL to SCL of board 24 | SDA to SDA of board 25 | CSB to 3.3V 26 | SDO to GND 27 | 28 | Refer pin map in the [document]{https://shakti.org.in/docs/shakti-soc-user-manual.pdf} 29 | 30 | cd FreeRTOS/FreeRTOS/Demo/shakti/vajra 31 | make 32 | 33 | Demo for parashu SoC 34 | ==================== 35 | 36 | Application same as above 37 | 38 | cd FreeRTOS/FreeRTOS/Demo/shakti/parashu 39 | make 40 | 41 | Demo for pinaka SoC 42 | =================== 43 | 44 | Read the value from GPIO0 port. Based on this value control the led connected to GPIO1. 45 | 46 | Refer pin map in the [document]{https://shakti.org.in/docs/shakti-soc-user-manual.pdf} 47 | 48 | cd FreeRTOS/FreeRTOS/Demo/shakti/pinaka 49 | make 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /shakti/bsp/include/clint_driver.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Project : shakti devt board 3 | * Name of the file : clint_driver.h 4 | * Brief Description of file : Header file for clint. 5 | * Name of Author : Sathya Narayanan N 6 | * Email ID : sathya281@gmail.com 7 | 8 | Copyright (C) 2019 IIT Madras. All rights reserved. 9 | 10 | This program is free software: you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 3 of the License, or 13 | (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program. If not, see . 22 | ***************************************************************************/ 23 | /** 24 | * @file clint_driver.h 25 | * @brief Header file for clint 26 | * @detail This is the header file for clint_driver.c 27 | */ 28 | 29 | #ifndef CLIC_DRIVER_H 30 | #define CLIC_DRIVER_H 31 | #include "traps.h" 32 | #include "platform.h" 33 | 34 | extern uint32_t* mtime; 35 | extern uint32_t* mtimecmp; 36 | 37 | /* function prototype */ 38 | uint64_t get_timer_value(void); 39 | void configure_counter(uint64_t value); 40 | void mach_clint_handler(uintptr_t int_id, uintptr_t epc); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /shakti/bsp/include/defines.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * Project : shakti devt board 3 | * Name of the file : defines.h 4 | * Brief Description of file : Header file for handling traps 5 | * Name of Author : Sathya Narayanan N 6 | * Email ID : sathya281@gmail.com 7 | 8 | Copyright (C) 2019 IIT Madras. All rights reserved. 9 | 10 | This program is free software: you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 3 of the License, or 13 | (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program. If not, see . 22 | **************************************************************************/ 23 | /** 24 | * @file defines.h 25 | * @brief Header file for handling traps 26 | * @detail This is the header file to hold some risc-v system definitions. 27 | */ 28 | 29 | #ifndef DEFINES_H 30 | #define DEFINES_H 31 | 32 | #define REGSIZE __riscv_xlen/8 33 | 34 | #if __riscv_xlen == 64 35 | #define LREG ld 36 | #define SREG sd 37 | #else 38 | #define LREG lw 39 | #define SREG sw 40 | #endif 41 | 42 | #define MSTATUS_MPP 0x00001800 43 | #define MSTATUS_FS 0x00006000 44 | 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /shakti/bsp/include/gpio.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * Project : shakti devt board 3 | * Name of the file : gpio.h 4 | * Brief Description of file : header file for gpio_applns 5 | * Name of Author : Sathya Narayanan N 6 | * Email ID : sathya281@gmail.com 7 | 8 | Copyright (C) 2019 IIT Madras. All rights reserved. 9 | 10 | This program is free software: you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 3 of the License, or 13 | (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program. If not, see . 22 | ***************************************************************************/ 23 | /** 24 | * @file gpio.h 25 | * @brief header file for gpio_applns 26 | */ 27 | 28 | #ifndef GPIO_H 29 | #define GPIO_H 30 | 31 | #include "platform.h" 32 | #include "stdint.h" 33 | 34 | #define GPIO_DIRECTION_CNTRL_REG (uint32_t*) (GPIO_START + (0 * GPIO_OFFSET )) 35 | #define GPIO_DATA_REG (uint32_t*) (GPIO_START + (1 * GPIO_OFFSET )) 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /shakti/bsp/include/gpio_spi.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Project : shakti devt board 3 | * Name of the file : gpio_spi.h 4 | * Brief Description of file : header file for spi gpio 5 | * Name of Author : Kottee & Aditya dubey 6 | * Email ID : kottee.1@gmail.com 7 | 8 | Copyright (C) 2019 IIT Madras. All rights reserved. 9 | 10 | This program is free software: you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 3 of the License, or 13 | (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program. If not, see . 22 | ****************************************************************************/ 23 | /** 24 | @file gpio_spi.h 25 | @brief headear file for spi gpio 26 | @detail this is header file for gpio_spi.c 27 | */ 28 | 29 | #ifndef GPIO_SPI_H 30 | #define GPIO_SPI_H 31 | 32 | #define IR_1 (1 << 4) 33 | #define IR_2 (1 << 5) 34 | #define IR_3 (1 << 6) 35 | #define IR_4 (1 << 7) 36 | #define IR_5 (1 << 8) 37 | 38 | #define SPI_MISO 1<<0 //1st bit 39 | #define SPI_MOSI 1<<1 //2nd bit 40 | #define SPI_SCLK 1<<2 //3rd bit 41 | #define SPI_SS 1<<3 //4th bit 42 | #define SPI_ADC_IN 0xC0 43 | 44 | // function prototype 45 | unsigned char readbyte(unsigned char delay); 46 | int config(); 47 | 48 | #endif/* GPIO_SPI_H*/ 49 | 50 | -------------------------------------------------------------------------------- /shakti/bsp/include/log.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Project : shakti devt board 3 | * Name of the file : log.h 4 | * Brief Description of file : Header file for logger. 5 | * Name of Author : Abhinav Ramnath 6 | * Email ID : abhinavramnath13@gmail.com 7 | 8 | Copyright (C) 2019 IIT Madras. All rights reserved. 9 | 10 | This program is free software: you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 3 of the License, or 13 | (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program. If not, see . 22 | ***************************************************************************/ 23 | /** 24 | * @file log.h 25 | * @brief Header file for logger. 26 | * @detail This file is used for logging. There are 6 levels of logging. 27 | Level 0 is the most critical. Usually system stops after level 0 logging. 28 | Level 3 is the default level of logging. 29 | */ 30 | 31 | #include 32 | 33 | // Log Levels 34 | #define TRACE 5 35 | #define DEBUG 4 36 | #define INFO 3 37 | #define WARN 2 38 | #define ERROR 1 39 | #define FATAL 0 40 | 41 | extern void vprintfmt(void (*putch)(int, void**), void **putdat, const char *fmt, va_list ap); 42 | 43 | //function prototype 44 | void log_trace(const char*fmt, ...); 45 | void log_info(const char*fmt, ...); 46 | void log_debug(const char*fmt, ...); 47 | void log_warn(const char*fmt, ...); 48 | void log_error(const char*fmt, ...); 49 | void log_fatal(const char*fmt, ...); 50 | -------------------------------------------------------------------------------- /shakti/bsp/include/memory.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Project : shakti devt board 3 | * Name of the file : memory.h 4 | * Brief Description of file : dumps values at memory mapped locations,useful for debugging 5 | * Name of Author : Sathya Narayanan N 6 | * Email ID : sathya281@gmail.com 7 | 8 | Copyright (C) 2019 IIT Madras. All rights reserved. 9 | 10 | This program is free software: you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 3 of the License, or 13 | (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program. If not, see . 22 | ***************************************************************************/ 23 | /** 24 | * @file memory.h 25 | * @brief dumps values at memory mapped locations, useful for debugging 26 | */ 27 | 28 | void dump_word_memory(uint32_t* start, uint32_t word_length); 29 | void dump_byte_memory(uint32_t* start, uint32_t word_length); 30 | 31 | -------------------------------------------------------------------------------- /shakti/bsp/include/pinmux.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Project : shakti devt board 3 | * Name of the file : pinmux.h 4 | * Brief Description of file : store pinmux configurations 5 | * Name of Author : Sathya Narayanan N 6 | * Email ID : sathya281@gmail.com 7 | 8 | Copyright (C) 2019 IIT Madras. All rights reserved. 9 | 10 | This program is free software: you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 3 of the License, or 13 | (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program. If not, see . 22 | *****************************************************************************/ 23 | /** 24 | * @file pinmux.h 25 | * @brief store pinmux configuration 26 | */ 27 | 28 | #ifndef PINMUX_H 29 | #define PINMUX_H 30 | #include "platform.h" 31 | 32 | volatile unsigned int* pinmux_config_reg = PINMUX_CONFIGURE_REG; 33 | 34 | #define PINMUX_CONFIG_1 35 | #define PINMUX_CONFIG_2 36 | #define PINMUX_CONFIG_3 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /shakti/bsp/include/utils.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Project : shakti devt board 3 | * Name of the file : utils.h 4 | * Brief Description of file : Header file for utils 5 | * Name of Author : Sathya Narayanan N 6 | * Email ID : sathya281@gmail.com 7 | 8 | Copyright (C) 2019 IIT Madras. All rights reserved. 9 | 10 | This program is free software: you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 3 of the License, or 13 | (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program. If not, see . 22 | *******************************************************************************/ 23 | /** 24 | * @file utils.h 25 | * @brief header file for utils 26 | * @detail This is the header file for util.c 27 | */ 28 | 29 | #ifndef UTIL_H 30 | #define UTIL_H 31 | #include 32 | #include 33 | 34 | /* function prototype */ 35 | void waitfor(unsigned int secs); 36 | void delay(unsigned long seconds); 37 | float pow_10(unsigned int y); 38 | void reverse(char *str, int len); 39 | void ftoa( float, char *, unsigned int); 40 | void delay_loop(unsigned long cntr1, unsigned long cntr2); 41 | unsigned long read_word(uint32_t *addr); 42 | void write_word(uint32_t *addr, unsigned long val); 43 | int int_to_string(int number, char str[], unsigned int afterpoint); 44 | void _printf_(const char *fmt, va_list ap); 45 | int printf(const char* fmt, ...); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /shakti/bsp/third_party/parashu/ftdi.cfg: -------------------------------------------------------------------------------- 1 | # ftdi.cfg- config commands for ftdi support 2 | 3 | # Created by Paul George 4 | # Email id: commandpaul@gmail.com 5 | 6 | # Copyright (C) 2019 IIT Madras. All rights reserved. 7 | 8 | # This program is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see . 19 | 20 | # ftdi_device_desc "Arty On-board FTDI interface" 21 | adapter speed 1000 22 | adapter driver ftdi 23 | ftdi_vid_pid 0x0403 0x6010 24 | ftdi_channel 0 25 | ftdi_layout_init 0x0088 0x008b 26 | reset_config none 27 | # debug_level 4 28 | 29 | set _CHIPNAME riscv 30 | jtag newtap $_CHIPNAME cpu -irlen 6; # -expected-id 0x0362d093 31 | 32 | set _TARGETNAME $_CHIPNAME.cpu 33 | 34 | target create $_TARGETNAME.0 riscv -chain-position $_TARGETNAME 35 | $_TARGETNAME.0 configure -work-area-phys 0x80000000 -work-area-size 10000 -work-area-backup 1 36 | riscv use_bscan_tunnel 5 1 37 | 38 | init 39 | if {[ info exists pulse_srst]} { 40 | ftdi_set_signal nSRST 0 41 | ftdi_set_signal nSRST z 42 | } 43 | halt 44 | -------------------------------------------------------------------------------- /shakti/bsp/third_party/pinaka/ftdi.cfg: -------------------------------------------------------------------------------- 1 | # ftdi.cfg- config commands for ftdi support 2 | 3 | # Created by Paul George 4 | # Email id: commandpaul@gmail.com 5 | 6 | # Copyright (C) 2019 IIT Madras. All rights reserved. 7 | 8 | # This program is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see . 19 | 20 | # ftdi_device_desc "Arty On-board FTDI interface" 21 | adapter speed 1000 22 | adapter driver ftdi 23 | ftdi_vid_pid 0x0403 0x6010 24 | ftdi_channel 0 25 | ftdi_layout_init 0x0088 0x008b 26 | reset_config none 27 | # debug_level 4 28 | 29 | set _CHIPNAME riscv 30 | jtag newtap $_CHIPNAME cpu -irlen 6; # -expected-id 0x0362d093 31 | 32 | set _TARGETNAME $_CHIPNAME.cpu 33 | 34 | target create $_TARGETNAME.0 riscv -chain-position $_TARGETNAME 35 | $_TARGETNAME.0 configure -work-area-phys 0x80000000 -work-area-size 10000 -work-area-backup 1 36 | riscv use_bscan_tunnel 5 1 37 | 38 | init 39 | if {[ info exists pulse_srst]} { 40 | ftdi_set_signal nSRST 0 41 | ftdi_set_signal nSRST z 42 | } 43 | halt 44 | -------------------------------------------------------------------------------- /shakti/bsp/third_party/vajra/ftdi.cfg: -------------------------------------------------------------------------------- 1 | 2 | # ftdi.cfg- config commands for ftdi support 3 | 4 | # Created by Paul George 5 | # Email id: commandpaul@gmail.com 6 | 7 | # Copyright (C) 2019 IIT Madras. All rights reserved. 8 | 9 | # This program is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program. If not, see . 20 | 21 | # ftdi_device_desc "Arty On-board FTDI interface" 22 | adapter speed 1000 23 | adapter driver ftdi 24 | ftdi_vid_pid 0x0403 0x6010 25 | ftdi_channel 0 26 | ftdi_layout_init 0x0088 0x008b 27 | reset_config none 28 | # debug_level 4 29 | 30 | set _CHIPNAME riscv 31 | jtag newtap $_CHIPNAME cpu -irlen 6; # -expected-id 0x0362d093 32 | 33 | set _TARGETNAME $_CHIPNAME.cpu 34 | 35 | target create $_TARGETNAME.0 riscv -chain-position $_TARGETNAME 36 | $_TARGETNAME.0 configure -work-area-phys 0x80000000 -work-area-size 10000 -work-area-backup 1 37 | riscv use_bscan_tunnel 5 1 38 | 39 | init 40 | if {[ info exists pulse_srst]} { 41 | ftdi_set_signal nSRST 0 42 | ftdi_set_signal nSRST z 43 | } 44 | halt 45 | -------------------------------------------------------------------------------- /shakti/bsp/utils/uploader/spansion/erase.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Project : shakti devt board 3 | * Name of the file : spi.c 4 | * Brief Description of file : Erase a sector of flash 5 | * Name of Author : Sathya Narayanan 6 | * Email ID : sathya281@gmail.com 7 | 8 | Copyright (C) 2020 IIT Madras. All rights reserved. 9 | 10 | This program is free software: you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation, either version 3 of the License, or 13 | (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program. If not, see . 22 | 23 | ***************************************************************************/ 24 | /** 25 | @file erase.c 26 | @brief Erase a sector of on-board flash in arty 35t/100t 27 | @detail Contains the code to erase a sector of on-board flash using spi 28 | protocol. 29 | */ 30 | 31 | #include 32 | #include "spi.h" 33 | #include "uart.h" 34 | 35 | /** @fn void main() 36 | * @brief Configures the SPI flash and writes into a flash location. 37 | * @details Configures the SPI flash, Confirms the flash device id,erases a sector 38 | * and then write into a flash location and prints the value. 39 | */ 40 | void main() 41 | { 42 | configure_spi(SPI0_OFFSET); 43 | spi_init(); 44 | 45 | printf("SPI init done\n"); 46 | 47 | flash_device_id(); 48 | 49 | waitfor(200); 50 | 51 | flash_write_enable(); 52 | flash_erase(0x00b00000); //erases an entire sector 53 | flash_status_register_read(); 54 | printf("\nErase complete"); 55 | 56 | asm volatile ("ebreak"); 57 | } 58 | 59 | --------------------------------------------------------------------------------