summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--ports/renesas-ra/Makefile3
-rw-r--r--ports/renesas-ra/boards/EK_RA4M1/ra_gen/hal_data.h2
-rw-r--r--ports/renesas-ra/boards/EK_RA4M1/ra_gen/main.c6
-rw-r--r--ports/renesas-ra/boards/EK_RA4M1/src/hal_entry.c58
-rw-r--r--ports/renesas-ra/boards/EK_RA4W1/ra_gen/hal_data.h2
-rw-r--r--ports/renesas-ra/boards/EK_RA4W1/ra_gen/main.c6
-rw-r--r--ports/renesas-ra/boards/EK_RA4W1/src/hal_entry.c59
-rw-r--r--ports/renesas-ra/boards/EK_RA6M1/ra_gen/hal_data.h2
-rw-r--r--ports/renesas-ra/boards/EK_RA6M1/ra_gen/main.c6
-rw-r--r--ports/renesas-ra/boards/EK_RA6M1/src/hal_entry.c58
-rw-r--r--ports/renesas-ra/boards/EK_RA6M2/ra_gen/hal_data.h1
-rw-r--r--ports/renesas-ra/boards/EK_RA6M2/ra_gen/main.c6
-rw-r--r--ports/renesas-ra/boards/EK_RA6M2/src/hal_entry.c58
-rw-r--r--ports/renesas-ra/boards/RA4M1_CLICKER/ra_gen/hal_data.h1
-rw-r--r--ports/renesas-ra/boards/RA4M1_CLICKER/ra_gen/main.c6
-rw-r--r--ports/renesas-ra/boards/RA4M1_CLICKER/src/hal_entry.c58
-rw-r--r--ports/renesas-ra/main.c4
-rw-r--r--ports/renesas-ra/ra_hal.c36
18 files changed, 39 insertions, 333 deletions
diff --git a/ports/renesas-ra/Makefile b/ports/renesas-ra/Makefile
index 85ffd9a1e9..2c9f917f36 100644
--- a/ports/renesas-ra/Makefile
+++ b/ports/renesas-ra/Makefile
@@ -297,6 +297,7 @@ DRIVERS_SRC_C += $(addprefix drivers/,\
SRC_C += \
boardctrl.c \
main.c \
+ ra_hal.c \
ra_it.c \
mphalport.c \
mpthreadport.c \
@@ -325,13 +326,11 @@ SRC_C += \
flashbdev.c \
storage.c \
fatfs_port.c \
- $(BOARD_DIR)/src/hal_entry.c \
$(wildcard $(BOARD_DIR)/*.c)
SRC_C += $(addprefix $(BOARD_DIR)/ra_gen/,\
common_data.c \
hal_data.c \
- main.c \
pin_data.c \
vector_data.c \
)
diff --git a/ports/renesas-ra/boards/EK_RA4M1/ra_gen/hal_data.h b/ports/renesas-ra/boards/EK_RA4M1/ra_gen/hal_data.h
index 7b1e505f68..635af82c2c 100644
--- a/ports/renesas-ra/boards/EK_RA4M1/ra_gen/hal_data.h
+++ b/ports/renesas-ra/boards/EK_RA4M1/ra_gen/hal_data.h
@@ -27,7 +27,5 @@ extern const flash_cfg_t g_flash0_cfg;
void NULL(flash_callback_args_t *p_args);
#endif
-void hal_entry(void);
-
FSP_FOOTER
#endif /* HAL_DATA_H_ */
diff --git a/ports/renesas-ra/boards/EK_RA4M1/ra_gen/main.c b/ports/renesas-ra/boards/EK_RA4M1/ra_gen/main.c
deleted file mode 100644
index 5b9f980559..0000000000
--- a/ports/renesas-ra/boards/EK_RA4M1/ra_gen/main.c
+++ /dev/null
@@ -1,6 +0,0 @@
-/* generated main source file - do not edit */
-#include "hal_data.h"
-int main(void) {
- hal_entry();
- return 0;
-}
diff --git a/ports/renesas-ra/boards/EK_RA4M1/src/hal_entry.c b/ports/renesas-ra/boards/EK_RA4M1/src/hal_entry.c
deleted file mode 100644
index c922cfd17a..0000000000
--- a/ports/renesas-ra/boards/EK_RA4M1/src/hal_entry.c
+++ /dev/null
@@ -1,58 +0,0 @@
-#include "hal_data.h"
-
-FSP_CPP_HEADER
-void R_BSP_WarmStart(bsp_warm_start_event_t event);
-FSP_CPP_FOOTER
-
-void ra_main(uint32_t reset_mode);
-
-/*******************************************************************************************************************//**
- * main() is generated by the RA Configuration editor and is used to generate threads if an RTOS is used. This function
- * is called by main() when no RTOS is used.
- **********************************************************************************************************************/
-void hal_entry(void) {
- /* TODO: add your own code here */
-
- ra_main(1);
-
- #if BSP_TZ_SECURE_BUILD
- /* Enter non-secure code */
- R_BSP_NonSecureEnter();
- #endif
-}
-
-/*******************************************************************************************************************//**
- * This function is called at various points during the startup process. This implementation uses the event that is
- * called right before main() to set up the pins.
- *
- * @param[in] event Where at in the start up process the code is currently at
- **********************************************************************************************************************/
-void R_BSP_WarmStart(bsp_warm_start_event_t event) {
- if (BSP_WARM_START_RESET == event) {
- #if BSP_FEATURE_FLASH_LP_VERSION != 0
-
- /* Enable reading from data flash. */
- R_FACI_LP->DFLCTL = 1U;
-
- /* Would normally have to wait tDSTOP(6us) for data flash recovery. Placing the enable here, before clock and
- * C runtime initialization, should negate the need for a delay since the initialization will typically take more than 6us. */
- #endif
- }
-
- if (BSP_WARM_START_POST_C == event) {
- /* C runtime environment and system clocks are setup. */
-
- /* Configure pins. */
- R_IOPORT_Open(&g_ioport_ctrl, &g_bsp_pin_cfg);
- }
-}
-
-#if BSP_TZ_SECURE_BUILD
-
-BSP_CMSE_NONSECURE_ENTRY void template_nonsecure_callable();
-
-/* Trustzone Secure Projects require at least one nonsecure callable function in order to build (Remove this if it is not required to build). */
-BSP_CMSE_NONSECURE_ENTRY void template_nonsecure_callable() {
-
-}
-#endif
diff --git a/ports/renesas-ra/boards/EK_RA4W1/ra_gen/hal_data.h b/ports/renesas-ra/boards/EK_RA4W1/ra_gen/hal_data.h
index 7b1e505f68..635af82c2c 100644
--- a/ports/renesas-ra/boards/EK_RA4W1/ra_gen/hal_data.h
+++ b/ports/renesas-ra/boards/EK_RA4W1/ra_gen/hal_data.h
@@ -27,7 +27,5 @@ extern const flash_cfg_t g_flash0_cfg;
void NULL(flash_callback_args_t *p_args);
#endif
-void hal_entry(void);
-
FSP_FOOTER
#endif /* HAL_DATA_H_ */
diff --git a/ports/renesas-ra/boards/EK_RA4W1/ra_gen/main.c b/ports/renesas-ra/boards/EK_RA4W1/ra_gen/main.c
deleted file mode 100644
index 5b9f980559..0000000000
--- a/ports/renesas-ra/boards/EK_RA4W1/ra_gen/main.c
+++ /dev/null
@@ -1,6 +0,0 @@
-/* generated main source file - do not edit */
-#include "hal_data.h"
-int main(void) {
- hal_entry();
- return 0;
-}
diff --git a/ports/renesas-ra/boards/EK_RA4W1/src/hal_entry.c b/ports/renesas-ra/boards/EK_RA4W1/src/hal_entry.c
deleted file mode 100644
index 3e53787c61..0000000000
--- a/ports/renesas-ra/boards/EK_RA4W1/src/hal_entry.c
+++ /dev/null
@@ -1,59 +0,0 @@
-#include "stdbool.h"
-#include "hal_data.h"
-
-FSP_CPP_HEADER
-void R_BSP_WarmStart(bsp_warm_start_event_t event);
-FSP_CPP_FOOTER
-
-void ra_main(uint32_t reset_mode);
-
-/*******************************************************************************************************************//**
- * main() is generated by the RA Configuration editor and is used to generate threads if an RTOS is used. This function
- * is called by main() when no RTOS is used.
- **********************************************************************************************************************/
-void hal_entry(void) {
- /* TODO: add your own code here */
-
- ra_main(1);
-
- #if BSP_TZ_SECURE_BUILD
- /* Enter non-secure code */
- R_BSP_NonSecureEnter();
- #endif
-}
-
-/*******************************************************************************************************************//**
- * This function is called at various points during the startup process. This implementation uses the event that is
- * called right before main() to set up the pins.
- *
- * @param[in] event Where at in the start up process the code is currently at
- **********************************************************************************************************************/
-void R_BSP_WarmStart(bsp_warm_start_event_t event) {
- if (BSP_WARM_START_RESET == event) {
- #if BSP_FEATURE_FLASH_LP_VERSION != 0
-
- /* Enable reading from data flash. */
- R_FACI_LP->DFLCTL = 1U;
-
- /* Would normally have to wait tDSTOP(6us) for data flash recovery. Placing the enable here, before clock and
- * C runtime initialization, should negate the need for a delay since the initialization will typically take more than 6us. */
- #endif
- }
-
- if (BSP_WARM_START_POST_C == event) {
- /* C runtime environment and system clocks are setup. */
-
- /* Configure pins. */
- R_IOPORT_Open(&g_ioport_ctrl, &g_bsp_pin_cfg);
- }
-}
-
-#if BSP_TZ_SECURE_BUILD
-
-BSP_CMSE_NONSECURE_ENTRY void template_nonsecure_callable();
-
-/* Trustzone Secure Projects require at least one nonsecure callable function in order to build (Remove this if it is not required to build). */
-BSP_CMSE_NONSECURE_ENTRY void template_nonsecure_callable() {
-
-}
-#endif
diff --git a/ports/renesas-ra/boards/EK_RA6M1/ra_gen/hal_data.h b/ports/renesas-ra/boards/EK_RA6M1/ra_gen/hal_data.h
index c661dfb183..bd940785ee 100644
--- a/ports/renesas-ra/boards/EK_RA6M1/ra_gen/hal_data.h
+++ b/ports/renesas-ra/boards/EK_RA6M1/ra_gen/hal_data.h
@@ -27,7 +27,5 @@ extern const flash_cfg_t g_flash0_cfg;
void NULL(flash_callback_args_t *p_args);
#endif
-void hal_entry(void);
-
FSP_FOOTER
#endif /* HAL_DATA_H_ */
diff --git a/ports/renesas-ra/boards/EK_RA6M1/ra_gen/main.c b/ports/renesas-ra/boards/EK_RA6M1/ra_gen/main.c
deleted file mode 100644
index 5b9f980559..0000000000
--- a/ports/renesas-ra/boards/EK_RA6M1/ra_gen/main.c
+++ /dev/null
@@ -1,6 +0,0 @@
-/* generated main source file - do not edit */
-#include "hal_data.h"
-int main(void) {
- hal_entry();
- return 0;
-}
diff --git a/ports/renesas-ra/boards/EK_RA6M1/src/hal_entry.c b/ports/renesas-ra/boards/EK_RA6M1/src/hal_entry.c
deleted file mode 100644
index c922cfd17a..0000000000
--- a/ports/renesas-ra/boards/EK_RA6M1/src/hal_entry.c
+++ /dev/null
@@ -1,58 +0,0 @@
-#include "hal_data.h"
-
-FSP_CPP_HEADER
-void R_BSP_WarmStart(bsp_warm_start_event_t event);
-FSP_CPP_FOOTER
-
-void ra_main(uint32_t reset_mode);
-
-/*******************************************************************************************************************//**
- * main() is generated by the RA Configuration editor and is used to generate threads if an RTOS is used. This function
- * is called by main() when no RTOS is used.
- **********************************************************************************************************************/
-void hal_entry(void) {
- /* TODO: add your own code here */
-
- ra_main(1);
-
- #if BSP_TZ_SECURE_BUILD
- /* Enter non-secure code */
- R_BSP_NonSecureEnter();
- #endif
-}
-
-/*******************************************************************************************************************//**
- * This function is called at various points during the startup process. This implementation uses the event that is
- * called right before main() to set up the pins.
- *
- * @param[in] event Where at in the start up process the code is currently at
- **********************************************************************************************************************/
-void R_BSP_WarmStart(bsp_warm_start_event_t event) {
- if (BSP_WARM_START_RESET == event) {
- #if BSP_FEATURE_FLASH_LP_VERSION != 0
-
- /* Enable reading from data flash. */
- R_FACI_LP->DFLCTL = 1U;
-
- /* Would normally have to wait tDSTOP(6us) for data flash recovery. Placing the enable here, before clock and
- * C runtime initialization, should negate the need for a delay since the initialization will typically take more than 6us. */
- #endif
- }
-
- if (BSP_WARM_START_POST_C == event) {
- /* C runtime environment and system clocks are setup. */
-
- /* Configure pins. */
- R_IOPORT_Open(&g_ioport_ctrl, &g_bsp_pin_cfg);
- }
-}
-
-#if BSP_TZ_SECURE_BUILD
-
-BSP_CMSE_NONSECURE_ENTRY void template_nonsecure_callable();
-
-/* Trustzone Secure Projects require at least one nonsecure callable function in order to build (Remove this if it is not required to build). */
-BSP_CMSE_NONSECURE_ENTRY void template_nonsecure_callable() {
-
-}
-#endif
diff --git a/ports/renesas-ra/boards/EK_RA6M2/ra_gen/hal_data.h b/ports/renesas-ra/boards/EK_RA6M2/ra_gen/hal_data.h
index 51fe21a160..5bb21e8880 100644
--- a/ports/renesas-ra/boards/EK_RA6M2/ra_gen/hal_data.h
+++ b/ports/renesas-ra/boards/EK_RA6M2/ra_gen/hal_data.h
@@ -23,6 +23,5 @@ extern const flash_instance_t g_flash0;
extern flash_hp_instance_ctrl_t g_flash0_ctrl;
extern const flash_cfg_t g_flash0_cfg;
-void hal_entry(void);
FSP_FOOTER
#endif /* HAL_DATA_H_ */
diff --git a/ports/renesas-ra/boards/EK_RA6M2/ra_gen/main.c b/ports/renesas-ra/boards/EK_RA6M2/ra_gen/main.c
deleted file mode 100644
index 5b9f980559..0000000000
--- a/ports/renesas-ra/boards/EK_RA6M2/ra_gen/main.c
+++ /dev/null
@@ -1,6 +0,0 @@
-/* generated main source file - do not edit */
-#include "hal_data.h"
-int main(void) {
- hal_entry();
- return 0;
-}
diff --git a/ports/renesas-ra/boards/EK_RA6M2/src/hal_entry.c b/ports/renesas-ra/boards/EK_RA6M2/src/hal_entry.c
deleted file mode 100644
index c922cfd17a..0000000000
--- a/ports/renesas-ra/boards/EK_RA6M2/src/hal_entry.c
+++ /dev/null
@@ -1,58 +0,0 @@
-#include "hal_data.h"
-
-FSP_CPP_HEADER
-void R_BSP_WarmStart(bsp_warm_start_event_t event);
-FSP_CPP_FOOTER
-
-void ra_main(uint32_t reset_mode);
-
-/*******************************************************************************************************************//**
- * main() is generated by the RA Configuration editor and is used to generate threads if an RTOS is used. This function
- * is called by main() when no RTOS is used.
- **********************************************************************************************************************/
-void hal_entry(void) {
- /* TODO: add your own code here */
-
- ra_main(1);
-
- #if BSP_TZ_SECURE_BUILD
- /* Enter non-secure code */
- R_BSP_NonSecureEnter();
- #endif
-}
-
-/*******************************************************************************************************************//**
- * This function is called at various points during the startup process. This implementation uses the event that is
- * called right before main() to set up the pins.
- *
- * @param[in] event Where at in the start up process the code is currently at
- **********************************************************************************************************************/
-void R_BSP_WarmStart(bsp_warm_start_event_t event) {
- if (BSP_WARM_START_RESET == event) {
- #if BSP_FEATURE_FLASH_LP_VERSION != 0
-
- /* Enable reading from data flash. */
- R_FACI_LP->DFLCTL = 1U;
-
- /* Would normally have to wait tDSTOP(6us) for data flash recovery. Placing the enable here, before clock and
- * C runtime initialization, should negate the need for a delay since the initialization will typically take more than 6us. */
- #endif
- }
-
- if (BSP_WARM_START_POST_C == event) {
- /* C runtime environment and system clocks are setup. */
-
- /* Configure pins. */
- R_IOPORT_Open(&g_ioport_ctrl, &g_bsp_pin_cfg);
- }
-}
-
-#if BSP_TZ_SECURE_BUILD
-
-BSP_CMSE_NONSECURE_ENTRY void template_nonsecure_callable();
-
-/* Trustzone Secure Projects require at least one nonsecure callable function in order to build (Remove this if it is not required to build). */
-BSP_CMSE_NONSECURE_ENTRY void template_nonsecure_callable() {
-
-}
-#endif
diff --git a/ports/renesas-ra/boards/RA4M1_CLICKER/ra_gen/hal_data.h b/ports/renesas-ra/boards/RA4M1_CLICKER/ra_gen/hal_data.h
index 41019e6dd6..bec40a3910 100644
--- a/ports/renesas-ra/boards/RA4M1_CLICKER/ra_gen/hal_data.h
+++ b/ports/renesas-ra/boards/RA4M1_CLICKER/ra_gen/hal_data.h
@@ -24,6 +24,5 @@ extern const flash_instance_t g_flash0;
extern flash_lp_instance_ctrl_t g_flash0_ctrl;
extern const flash_cfg_t g_flash0_cfg;
-void hal_entry(void);
FSP_FOOTER
#endif /* HAL_DATA_H_ */
diff --git a/ports/renesas-ra/boards/RA4M1_CLICKER/ra_gen/main.c b/ports/renesas-ra/boards/RA4M1_CLICKER/ra_gen/main.c
deleted file mode 100644
index 5b9f980559..0000000000
--- a/ports/renesas-ra/boards/RA4M1_CLICKER/ra_gen/main.c
+++ /dev/null
@@ -1,6 +0,0 @@
-/* generated main source file - do not edit */
-#include "hal_data.h"
-int main(void) {
- hal_entry();
- return 0;
-}
diff --git a/ports/renesas-ra/boards/RA4M1_CLICKER/src/hal_entry.c b/ports/renesas-ra/boards/RA4M1_CLICKER/src/hal_entry.c
deleted file mode 100644
index c922cfd17a..0000000000
--- a/ports/renesas-ra/boards/RA4M1_CLICKER/src/hal_entry.c
+++ /dev/null
@@ -1,58 +0,0 @@
-#include "hal_data.h"
-
-FSP_CPP_HEADER
-void R_BSP_WarmStart(bsp_warm_start_event_t event);
-FSP_CPP_FOOTER
-
-void ra_main(uint32_t reset_mode);
-
-/*******************************************************************************************************************//**
- * main() is generated by the RA Configuration editor and is used to generate threads if an RTOS is used. This function
- * is called by main() when no RTOS is used.
- **********************************************************************************************************************/
-void hal_entry(void) {
- /* TODO: add your own code here */
-
- ra_main(1);
-
- #if BSP_TZ_SECURE_BUILD
- /* Enter non-secure code */
- R_BSP_NonSecureEnter();
- #endif
-}
-
-/*******************************************************************************************************************//**
- * This function is called at various points during the startup process. This implementation uses the event that is
- * called right before main() to set up the pins.
- *
- * @param[in] event Where at in the start up process the code is currently at
- **********************************************************************************************************************/
-void R_BSP_WarmStart(bsp_warm_start_event_t event) {
- if (BSP_WARM_START_RESET == event) {
- #if BSP_FEATURE_FLASH_LP_VERSION != 0
-
- /* Enable reading from data flash. */
- R_FACI_LP->DFLCTL = 1U;
-
- /* Would normally have to wait tDSTOP(6us) for data flash recovery. Placing the enable here, before clock and
- * C runtime initialization, should negate the need for a delay since the initialization will typically take more than 6us. */
- #endif
- }
-
- if (BSP_WARM_START_POST_C == event) {
- /* C runtime environment and system clocks are setup. */
-
- /* Configure pins. */
- R_IOPORT_Open(&g_ioport_ctrl, &g_bsp_pin_cfg);
- }
-}
-
-#if BSP_TZ_SECURE_BUILD
-
-BSP_CMSE_NONSECURE_ENTRY void template_nonsecure_callable();
-
-/* Trustzone Secure Projects require at least one nonsecure callable function in order to build (Remove this if it is not required to build). */
-BSP_CMSE_NONSECURE_ENTRY void template_nonsecure_callable() {
-
-}
-#endif
diff --git a/ports/renesas-ra/main.c b/ports/renesas-ra/main.c
index 6ba26cd7ba..8f4baa8e2a 100644
--- a/ports/renesas-ra/main.c
+++ b/ports/renesas-ra/main.c
@@ -210,7 +210,7 @@ MP_NOINLINE STATIC bool init_flash_fs(uint reset_mode) {
}
#endif
-void ra_main(uint32_t reset_mode) {
+int main(void) {
// Hook for a board to run code at start up, for example check if a
// bootloader should be entered instead of the main application.
MICROPY_BOARD_STARTUP();
@@ -256,7 +256,7 @@ void ra_main(uint32_t reset_mode) {
#endif
boardctrl_state_t state;
- state.reset_mode = reset_mode;
+ state.reset_mode = 1;
state.log_soft_reset = false;
MICROPY_BOARD_BEFORE_SOFT_RESET_LOOP(&state);
diff --git a/ports/renesas-ra/ra_hal.c b/ports/renesas-ra/ra_hal.c
new file mode 100644
index 0000000000..13eb53d121
--- /dev/null
+++ b/ports/renesas-ra/ra_hal.c
@@ -0,0 +1,36 @@
+#include "hal_data.h"
+
+void R_BSP_WarmStart(bsp_warm_start_event_t event);
+
+// This function is called at various points during the startup process.
+// event: where in the start up process the code is currently at.
+void R_BSP_WarmStart(bsp_warm_start_event_t event) {
+ if (BSP_WARM_START_RESET == event) {
+ #if BSP_FEATURE_FLASH_LP_VERSION != 0
+
+ // Enable reading from data flash.
+ R_FACI_LP->DFLCTL = 1U;
+
+ // Would normally have to wait tDSTOP(6us) for data flash recovery. Placing the
+ // enable here, before clock and C runtime initialization, should negate the need
+ // for a delay since the initialization will typically take more than 6us.
+ #endif
+ }
+
+ if (BSP_WARM_START_POST_C == event) {
+ // At this point, C runtime environment and system clocks are set up.
+
+ // Configure pins.
+ R_IOPORT_Open(&g_ioport_ctrl, &g_bsp_pin_cfg);
+ }
+}
+
+#if BSP_TZ_SECURE_BUILD
+
+BSP_CMSE_NONSECURE_ENTRY void template_nonsecure_callable();
+
+// Trustzone Secure Projects require at least one nonsecure callable function in order to build.
+BSP_CMSE_NONSECURE_ENTRY void template_nonsecure_callable() {
+}
+
+#endif