Added basic MRB app.

Signed-off-by: Yilin Sun <imi415@imi.moe>
This commit is contained in:
Yilin Sun 2023-03-03 18:07:20 +08:00
parent b786350481
commit 72f1a62ab6
Signed by: imi415
GPG Key ID: 885EC2B5A8A6F8A7
11 changed files with 185 additions and 16 deletions

3
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "SDK"]
path = SDK
url = https://git.minori.work/Embedded_SDK/MCUXpresso_LPC55S69.git
[submodule "lib/mruby"]
path = lib/mruby
url = https://git.minori.work/Embedded_Projects/MRuby_MCUXpresso.git

View File

@ -6,7 +6,7 @@ enable_language(CXX)
enable_language(ASM)
# Different linker scripts
set(TARGET_LDSCRIPT_FLASH "${CMAKE_SOURCE_DIR}/SDK/devices/LPC55S69/gcc/LPC55S69_cm33_core0_flash.ld")
set(TARGET_LDSCRIPT_FLASH "${CMAKE_SOURCE_DIR}/app_flash.ld")
set(TARGET_LDSCRIPT_RAM "${CMAKE_SOURCE_DIR}/SDK/devices/LPC55S69/gcc/LPC55S69_cm33_core0_ram.ld")
set(TARGET_SOURCES
@ -85,6 +85,7 @@ set(TARGET_C_INCLUDES
# Shared libraries linked with application
set(TARGET_LIBS
"mruby_mcux"
"c"
"m"
"nosys"
@ -92,7 +93,7 @@ set(TARGET_LIBS
# Shared library and linker script search paths
set(TARGET_LIB_DIRECTORIES
"${CMAKE_SOURCE_DIR}/SDK/devices/LPC55S69/gcc"
)
# Conditional flags
@ -113,6 +114,9 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-common -fno-builtin -f
set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
set(MRUBY_MCUX_TARGET "lpc55s69")
add_subdirectory(lib/mruby)
# Shared sources, includes and definitions
add_compile_definitions(${TARGET_C_DEFINES})
include_directories(${TARGET_C_INCLUDES})

View File

@ -20,13 +20,13 @@
<generate_registers_defines>false</generate_registers_defines>
</preferences>
<tools>
<pins name="Pins" version="12.0" enabled="true" update_project_code="true">
<pins name="Pins" version="13.0" enabled="true" update_project_code="true">
<generated_project_files>
<file path="board/pin_mux.c" update_enabled="true"/>
<file path="board/pin_mux.h" update_enabled="true"/>
</generated_project_files>
<pins_profile>
<processor_version>12.0.0</processor_version>
<processor_version>13.0.1</processor_version>
</pins_profile>
<functions_list>
<function name="BOARD_InitDEBUG_UARTPins">
@ -518,13 +518,13 @@
</function>
</functions_list>
</pins>
<clocks name="Clocks" version="10.0" enabled="true" update_project_code="true">
<clocks name="Clocks" version="11.0" enabled="true" update_project_code="true">
<generated_project_files>
<file path="board/clock_config.c" update_enabled="true"/>
<file path="board/clock_config.h" update_enabled="true"/>
</generated_project_files>
<clocks_profile>
<processor_version>12.0.0</processor_version>
<processor_version>13.0.1</processor_version>
</clocks_profile>
<clock_configurations>
<clock_configuration name="BOARD_BootClockFRO12M" id_prefix="" prefix_user_defined="false">
@ -771,13 +771,13 @@
</dcdx_profile>
<dcdx_configurations/>
</dcdx>
<periphs name="Peripherals" version="11.0" enabled="true" update_project_code="true">
<periphs name="Peripherals" version="12.0" enabled="true" update_project_code="true">
<generated_project_files>
<file path="board/peripherals.c" update_enabled="true"/>
<file path="board/peripherals.h" update_enabled="true"/>
</generated_project_files>
<peripherals_profile>
<processor_version>12.0.0</processor_version>
<processor_version>13.0.1</processor_version>
</peripherals_profile>
<functional_groups>
<functional_group name="BOARD_InitPeripherals_cm33_core0" uuid="61d0725d-b300-49cb-9c66-b5edfbf8ffc1" called_from_default_init="true" id_prefix="" core="cm33_core0">
@ -789,7 +789,7 @@
<config_set name="fsl_i2c" quick_selection="QS_I2C_Master">
<setting name="i2c_mode" value="kI2C_Master"/>
<setting name="clockSource" value="FXCOMFunctionClock"/>
<setting name="clockSourceFreq" value="BOARD_BootClockPLL150M"/>
<setting name="clockSourceFreq" value="ClocksTool_DefaultInit"/>
<struct name="i2c_master_config">
<setting name="enableMaster" value="true"/>
<setting name="baudRate_Bps" value="100000"/>

1
SDK Submodule

@ -0,0 +1 @@
Subproject commit 3969019d6a43b0b76c8227cbd5b9640047c41c0d

4
app_flash.ld Normal file
View File

@ -0,0 +1,4 @@
__stack_size__ = 0x4000;
__heap_size__ = 0x8000;
INCLUDE LPC55S69_cm33_core0_flash.ld

View File

@ -17,11 +17,11 @@
/* clang-format off */
/* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
!!GlobalInfo
product: Clocks v10.0
product: Clocks v11.0
processor: LPC55S69
package_id: LPC55S69JBD100
mcu_data: ksdk2_0
processor_version: 12.0.0
processor_version: 13.0.1
board: LPCXpresso55S69
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
/* clang-format on */

View File

@ -41,6 +41,42 @@ void BOARD_InitBootClocks(void);
#define BOARD_BOOTCLOCKFRO12M_CORE_CLOCK 12000000U /*!< Core clock frequency: 12000000Hz */
/* Clock outputs (values are in Hz): */
#define BOARD_BOOTCLOCKFRO12M_ASYNCADC_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_CLKOUT_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_CTIMER0_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_CTIMER1_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_CTIMER2_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_CTIMER3_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_CTIMER4_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_FXCOM0_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_FXCOM1_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_FXCOM2_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_FXCOM3_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_FXCOM4_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_FXCOM5_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_FXCOM6_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_FXCOM7_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_HSLSPI_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_MCLK_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_OSC32KHZ_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_OSTIMER32KHZ_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_PLUCLKIN_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_PLU_GLITCH_12MHZ_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_PLU_GLITCH_1MHZ_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_RTC1HZ_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_RTC1KHZ_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_SCT_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_SDIO_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_SYSTICK0_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_SYSTICK1_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_SYSTEM_CLOCK 12000000UL
#define BOARD_BOOTCLOCKFRO12M_TRACE_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_USB0_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_USB1_PHY_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_UTICK_CLOCK 0UL
#define BOARD_BOOTCLOCKFRO12M_WDT_CLOCK 0UL
/*******************************************************************************
* API for BOARD_BootClockFRO12M configuration
******************************************************************************/
@ -67,6 +103,42 @@ void BOARD_BootClockFRO12M(void);
#define BOARD_BOOTCLOCKFROHF96M_CORE_CLOCK 96000000U /*!< Core clock frequency: 96000000Hz */
/* Clock outputs (values are in Hz): */
#define BOARD_BOOTCLOCKFROHF96M_ASYNCADC_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_CLKOUT_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_CTIMER0_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_CTIMER1_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_CTIMER2_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_CTIMER3_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_CTIMER4_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_FXCOM0_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_FXCOM1_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_FXCOM2_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_FXCOM3_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_FXCOM4_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_FXCOM5_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_FXCOM6_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_FXCOM7_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_HSLSPI_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_MCLK_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_OSC32KHZ_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_OSTIMER32KHZ_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_PLUCLKIN_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_PLU_GLITCH_12MHZ_CLOCK0UL
#define BOARD_BOOTCLOCKFROHF96M_PLU_GLITCH_1MHZ_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_RTC1HZ_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_RTC1KHZ_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_SCT_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_SDIO_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_SYSTICK0_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_SYSTICK1_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_SYSTEM_CLOCK 96000000UL
#define BOARD_BOOTCLOCKFROHF96M_TRACE_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_USB0_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_USB1_PHY_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_UTICK_CLOCK 0UL
#define BOARD_BOOTCLOCKFROHF96M_WDT_CLOCK 0UL
/*******************************************************************************
* API for BOARD_BootClockFROHF96M configuration
******************************************************************************/
@ -93,6 +165,42 @@ void BOARD_BootClockFROHF96M(void);
#define BOARD_BOOTCLOCKPLL100M_CORE_CLOCK 100000000U /*!< Core clock frequency: 100000000Hz */
/* Clock outputs (values are in Hz): */
#define BOARD_BOOTCLOCKPLL100M_ASYNCADC_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_CLKOUT_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_CTIMER0_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_CTIMER1_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_CTIMER2_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_CTIMER3_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_CTIMER4_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_FXCOM0_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_FXCOM1_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_FXCOM2_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_FXCOM3_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_FXCOM4_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_FXCOM5_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_FXCOM6_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_FXCOM7_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_HSLSPI_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_MCLK_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_OSC32KHZ_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_OSTIMER32KHZ_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_PLUCLKIN_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_PLU_GLITCH_12MHZ_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_PLU_GLITCH_1MHZ_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_RTC1HZ_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_RTC1KHZ_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_SCT_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_SDIO_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_SYSTICK0_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_SYSTICK1_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_SYSTEM_CLOCK 100000000UL
#define BOARD_BOOTCLOCKPLL100M_TRACE_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_USB0_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_USB1_PHY_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_UTICK_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL100M_WDT_CLOCK 0UL
/*******************************************************************************
* API for BOARD_BootClockPLL100M configuration
******************************************************************************/
@ -119,6 +227,42 @@ void BOARD_BootClockPLL100M(void);
#define BOARD_BOOTCLOCKPLL150M_CORE_CLOCK 150000000U /*!< Core clock frequency: 150000000Hz */
/* Clock outputs (values are in Hz): */
#define BOARD_BOOTCLOCKPLL150M_ASYNCADC_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_CLKOUT_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_CTIMER0_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_CTIMER1_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_CTIMER2_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_CTIMER3_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_CTIMER4_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_FXCOM0_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_FXCOM1_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_FXCOM2_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_FXCOM3_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_FXCOM4_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_FXCOM5_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_FXCOM6_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_FXCOM7_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_HSLSPI_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_MCLK_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_OSC32KHZ_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_OSTIMER32KHZ_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_PLUCLKIN_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_PLU_GLITCH_12MHZ_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_PLU_GLITCH_1MHZ_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_RTC1HZ_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_RTC1KHZ_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_SCT_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_SDIO_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_SYSTICK0_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_SYSTICK1_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_SYSTEM_CLOCK 150000000UL
#define BOARD_BOOTCLOCKPLL150M_TRACE_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_USB0_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_USB1_PHY_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_UTICK_CLOCK 0UL
#define BOARD_BOOTCLOCKPLL150M_WDT_CLOCK 0UL
/*******************************************************************************
* API for BOARD_BootClockPLL150M configuration
******************************************************************************/

View File

@ -6,11 +6,11 @@
/* clang-format off */
/* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
!!GlobalInfo
product: Peripherals v11.0
product: Peripherals v12.0
processor: LPC55S69
package_id: LPC55S69JBD100
mcu_data: ksdk2_0
processor_version: 12.0.0
processor_version: 13.0.1
board: LPCXpresso55S69
functionalGroups:
- name: BOARD_InitPeripherals_cm33_core0

View File

@ -7,11 +7,11 @@
/*
* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
!!GlobalInfo
product: Pins v12.0
product: Pins v13.0
processor: LPC55S69
package_id: LPC55S69JBD100
mcu_data: ksdk2_0
processor_version: 12.0.0
processor_version: 13.0.1
board: LPCXpresso55S69
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
*/

1
lib/mruby Submodule

@ -0,0 +1 @@
Subproject commit d31acdb6fa8e857bb6de4a0bbb630c14dac25e00

View File

@ -1,3 +1,5 @@
#include <math.h>
#include "board.h"
#include "clock_config.h"
#include "peripherals.h"
@ -5,6 +7,9 @@
#include "fsl_debug_console.h"
#include "mruby.h"
#include "mruby/compile.h"
int main(void) {
BOARD_InitBootPins();
BOARD_BootClockFROHF96M();
@ -12,7 +17,14 @@ int main(void) {
BOARD_InitDebugConsole();
PRINTF("Hello world!!\r\n");
mrb_state* mrb = mrb_open();
mrbc_context *cxt = mrbc_context_new(mrb);
PRINTF("MRuby Version: %s\r\n", MRUBY_RUBY_VERSION);
mrbc_cleanup_local_variables(mrb, cxt);
mrbc_context_free(mrb, cxt);
mrb_close(mrb);
for(;;) {
__WFI();