Skip to content

Commit bb2f3bd

Browse files
committed
Added new bootloader board type "opta_expansion"
This board is for opta expansion (it is just a copy of uno_r4 with 1 change -> it does not use the USB_LDO)
1 parent 6913cc0 commit bb2f3bd

File tree

9 files changed

+257
-0
lines changed

9 files changed

+257
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
set(CMAKE_SYSTEM_PROCESSOR cortex-m4 CACHE INTERNAL "System Processor")
2+
set(MCU_VARIANT ra4m1)
3+
4+
set(JLINK_DEVICE R7FA4M1AB)
5+
set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/${BOARD}.ld)
6+
7+
function(update_board TARGET)
8+
# target_compile_definitions(${TARGET} PUBLIC)
9+
# target_sources(${TARGET} PRIVATE)
10+
# target_include_directories(${BOARD_TARGET} PUBLIC)
11+
endfunction()
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2023 Ha Thach (tinyusb.org)
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
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,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*
24+
* This file is part of the TinyUSB stack.
25+
*/
26+
27+
#ifndef _BOARD_H_
28+
#define _BOARD_H_
29+
30+
#ifdef __cplusplus
31+
extern "C" {
32+
#endif
33+
34+
#define LED1 BSP_IO_PORT_01_PIN_11 // D13
35+
#define LED_STATE_ON 1
36+
37+
#define SW1 BSP_IO_PORT_01_PIN_10 // D12
38+
#define BUTTON_STATE_ACTIVE 0
39+
40+
static const ioport_pin_cfg_t board_pin_cfg[] = {
41+
{.pin = LED1, .pin_cfg = IOPORT_CFG_PORT_DIRECTION_OUTPUT},
42+
{.pin = SW1, .pin_cfg = IOPORT_CFG_PORT_DIRECTION_INPUT},
43+
// USB FS D+, D-, VBus
44+
{.pin = BSP_IO_PORT_04_PIN_07, .pin_cfg = IOPORT_CFG_PERIPHERAL_PIN | IOPORT_PERIPHERAL_USB_FS},
45+
{.pin = BSP_IO_PORT_09_PIN_14, .pin_cfg = IOPORT_CFG_PERIPHERAL_PIN | IOPORT_PERIPHERAL_USB_FS},
46+
{.pin = BSP_IO_PORT_09_PIN_15, .pin_cfg = IOPORT_CFG_PERIPHERAL_PIN | IOPORT_PERIPHERAL_USB_FS},
47+
};
48+
49+
#ifdef __cplusplus
50+
}
51+
#endif
52+
53+
#endif
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CPU_CORE = cortex-m4
2+
MCU_VARIANT = ra4m1
3+
4+
LD_FILE = ${BOARD_PATH}/${BOARD}.ld
5+
6+
# For flash-jlink target
7+
JLINK_DEVICE = R7FA4M1AB
8+
9+
flash: flash-jlink
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/* generated configuration header file - do not edit */
2+
#ifndef BSP_CFG_H_
3+
#define BSP_CFG_H_
4+
5+
#include "bsp_clock_cfg.h"
6+
#include "bsp_mcu_family_cfg.h"
7+
#include "board_cfg.h"
8+
9+
#undef RA_NOT_DEFINED
10+
#define BSP_CFG_RTOS (0)
11+
#if defined(_RA_BOOT_IMAGE)
12+
#define BSP_CFG_BOOT_IMAGE (1)
13+
#endif
14+
#define BSP_CFG_MCU_VCC_MV (3300)
15+
#define BSP_CFG_STACK_MAIN_BYTES (0x800)
16+
#define BSP_CFG_HEAP_BYTES (0x1000)
17+
#define BSP_CFG_PARAM_CHECKING_ENABLE (1)
18+
#define BSP_CFG_ASSERT (0)
19+
#define BSP_CFG_ERROR_LOG (0)
20+
21+
#define BSP_CFG_PFS_PROTECT ((1))
22+
23+
#define BSP_CFG_C_RUNTIME_INIT ((1))
24+
#define BSP_CFG_EARLY_INIT ((0))
25+
26+
#define BSP_CFG_STARTUP_CLOCK_REG_NOT_RESET ((0))
27+
28+
#define BSP_CLOCK_CFG_MAIN_OSC_POPULATED (0)
29+
30+
#define BSP_CLOCK_CFG_MAIN_OSC_CLOCK_SOURCE (0)
31+
#define BSP_CLOCK_CFG_SUBCLOCK_DRIVE (0)
32+
#define BSP_CLOCK_CFG_SUBCLOCK_POPULATED (0)
33+
#define BSP_CLOCK_CFG_SUBCLOCK_STABILIZATION_MS 1000
34+
35+
#endif /* BSP_CFG_H_ */
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/* generated configuration header file - do not edit */
2+
#ifndef BSP_MCU_DEVICE_CFG_H_
3+
#define BSP_MCU_DEVICE_CFG_H_
4+
#define BSP_CFG_MCU_PART_SERIES (4)
5+
#endif /* BSP_MCU_DEVICE_CFG_H_ */
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* generated configuration header file - do not edit */
2+
#ifndef BSP_MCU_DEVICE_PN_CFG_H_
3+
#define BSP_MCU_DEVICE_PN_CFG_H_
4+
#define BSP_MCU_R7FA4M1AB3CNE
5+
#define BSP_MCU_FEATURE_SET ('A')
6+
#define BSP_ROM_SIZE_BYTES (262144)
7+
#define BSP_RAM_SIZE_BYTES (32768)
8+
#define BSP_DATA_FLASH_SIZE_BYTES (8192)
9+
#define BSP_PACKAGE_QFN
10+
#define BSP_PACKAGE_PINS (48)
11+
#endif /* BSP_MCU_DEVICE_PN_CFG_H_ */
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/* generated configuration header file through renesas e2 studio */
2+
#ifndef BSP_MCU_FAMILY_CFG_H_
3+
#define BSP_MCU_FAMILY_CFG_H_
4+
5+
#ifdef __cplusplus
6+
extern "C" {
7+
#endif
8+
9+
#include "bsp_mcu_device_pn_cfg.h"
10+
#include "bsp_mcu_device_cfg.h"
11+
#include "bsp_mcu_info.h"
12+
#include "bsp_clock_cfg.h"
13+
14+
#define BSP_MCU_GROUP_RA4M1 (1)
15+
#define BSP_LOCO_HZ (32768)
16+
#define BSP_MOCO_HZ (8000000)
17+
#define BSP_SUB_CLOCK_HZ (32768)
18+
#if BSP_CFG_HOCO_FREQUENCY == 0
19+
#define BSP_HOCO_HZ (24000000)
20+
#elif BSP_CFG_HOCO_FREQUENCY == 2
21+
#define BSP_HOCO_HZ (32000000)
22+
#elif BSP_CFG_HOCO_FREQUENCY == 4
23+
#define BSP_HOCO_HZ (48000000)
24+
#elif BSP_CFG_HOCO_FREQUENCY == 5
25+
#define BSP_HOCO_HZ (64000000)
26+
#else
27+
#error "Invalid HOCO frequency chosen (BSP_CFG_HOCO_FREQUENCY) in bsp_clock_cfg.h"
28+
#endif
29+
#define BSP_CORTEX_VECTOR_TABLE_ENTRIES (16U)
30+
#define BSP_VECTOR_TABLE_MAX_ENTRIES (48U)
31+
#define BSP_MCU_VBATT_SUPPORT (1)
32+
33+
#define OFS_SEQ1 0xA001A001 | (1 << 1) | (3 << 2)
34+
#define OFS_SEQ2 (15 << 4) | (3 << 8) | (3 << 10)
35+
#define OFS_SEQ3 (1 << 12) | (1 << 14) | (1 << 17)
36+
#define OFS_SEQ4 (3 << 18) |(15 << 20) | (3 << 24) | (3 << 26)
37+
#define OFS_SEQ5 (1 << 28) | (1 << 30)
38+
#define BSP_CFG_ROM_REG_OFS0 (OFS_SEQ1 | OFS_SEQ2 | OFS_SEQ3 | OFS_SEQ4 | OFS_SEQ5)
39+
#define BSP_CFG_ROM_REG_OFS1 (0xFFFFFEC3 | (1 << 2) | (3 << 3) | (0 << 8))
40+
#define BSP_CFG_USE_LOW_VOLTAGE_MODE ((0))
41+
#define BSP_CFG_ROM_REG_MPU_PC0_ENABLE (1)
42+
#define BSP_CFG_ROM_REG_MPU_PC0_START (0x00FFFFFC)
43+
#define BSP_CFG_ROM_REG_MPU_PC0_END (0x00FFFFFF)
44+
#define BSP_CFG_ROM_REG_MPU_PC1_ENABLE (1)
45+
#define BSP_CFG_ROM_REG_MPU_PC1_START (0x00FFFFFC)
46+
#define BSP_CFG_ROM_REG_MPU_PC1_END (0x00FFFFFF)
47+
#define BSP_CFG_ROM_REG_MPU_REGION0_ENABLE (1)
48+
#define BSP_CFG_ROM_REG_MPU_REGION0_START (0x00FFFFFC)
49+
#define BSP_CFG_ROM_REG_MPU_REGION0_END (0x00FFFFFF)
50+
#define BSP_CFG_ROM_REG_MPU_REGION1_ENABLE (1)
51+
#define BSP_CFG_ROM_REG_MPU_REGION1_START (0x200FFFFC)
52+
#define BSP_CFG_ROM_REG_MPU_REGION1_END (0x200FFFFF)
53+
#define BSP_CFG_ROM_REG_MPU_REGION2_ENABLE (1)
54+
#define BSP_CFG_ROM_REG_MPU_REGION2_START (0x407FFFFC)
55+
#define BSP_CFG_ROM_REG_MPU_REGION2_END (0x407FFFFF)
56+
#define BSP_CFG_ROM_REG_MPU_REGION3_ENABLE (1)
57+
#define BSP_CFG_ROM_REG_MPU_REGION3_START (0x400DFFFC)
58+
#define BSP_CFG_ROM_REG_MPU_REGION3_END (0x400DFFFF)
59+
#ifndef BSP_CLOCK_CFG_MAIN_OSC_WAIT
60+
#define BSP_CLOCK_CFG_MAIN_OSC_WAIT (9)
61+
#endif
62+
/* Used to create IELS values for the interrupt initialization table g_interrupt_event_link_select. */
63+
#define BSP_PRV_IELS_ENUM(vector) (ELC_ ## vector)
64+
65+
/*
66+
ID Code
67+
Note: To permanently lock and disable the debug interface define the BSP_ID_CODE_PERMANENTLY_LOCKED in the compiler settings.
68+
WARNING: This will disable debug access to the part and cannot be reversed by a debug probe.
69+
*/
70+
#if defined(BSP_ID_CODE_PERMANENTLY_LOCKED)
71+
#define BSP_CFG_ID_CODE_LONG_1 (0x00000000)
72+
#define BSP_CFG_ID_CODE_LONG_2 (0x00000000)
73+
#define BSP_CFG_ID_CODE_LONG_3 (0x00000000)
74+
#define BSP_CFG_ID_CODE_LONG_4 (0x00000000)
75+
#else
76+
/* ID CODE: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF */
77+
#define BSP_CFG_ID_CODE_LONG_1 (0xFFFFFFFF)
78+
#define BSP_CFG_ID_CODE_LONG_2 (0xFFFFFFFF)
79+
#define BSP_CFG_ID_CODE_LONG_3 (0xFFFFFFFF)
80+
#define BSP_CFG_ID_CODE_LONG_4 (0xffFFFFFF)
81+
#endif
82+
83+
#ifdef __cplusplus
84+
}
85+
#endif
86+
87+
#endif /* BSP_MCU_FAMILY_CFG_H_ */
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/* generated configuration header file - do not edit */
2+
#ifndef BSP_CLOCK_CFG_H_
3+
#define BSP_CLOCK_CFG_H_
4+
#define BSP_CFG_CLOCKS_SECURE (0)
5+
#define BSP_CFG_CLOCKS_OVERRIDE (0)
6+
#define BSP_CFG_XTAL_HZ (0) /* XTAL 0Hz */
7+
#define BSP_CFG_PLL_SOURCE (BSP_CLOCKS_CLOCK_DISABLED) /* PLL Src: XTAL */
8+
#define BSP_CFG_HOCO_FREQUENCY (4) /* HOCO 48MHz */
9+
#define BSP_CFG_PLL_DIV (BSP_CLOCKS_PLL_DIV_4) /* PLL Div /4 */
10+
#define BSP_CFG_PLL_MUL BSP_CLOCKS_PLL_MUL(12, 0) /* PLL Mul x12 */
11+
#define BSP_CFG_CLOCK_SOURCE (BSP_CLOCKS_SOURCE_CLOCK_HOCO) /* Clock Src: HOCO */
12+
#define BSP_CFG_ICLK_DIV (BSP_CLOCKS_SYS_CLOCK_DIV_1) /* ICLK Div /1 */
13+
#define BSP_CFG_PCLKA_DIV (BSP_CLOCKS_SYS_CLOCK_DIV_1) /* PCLKA Div /1 */
14+
#define BSP_CFG_PCLKB_DIV (BSP_CLOCKS_SYS_CLOCK_DIV_2) /* PCLKB Div /2 */
15+
#define BSP_CFG_PCLKC_DIV (BSP_CLOCKS_SYS_CLOCK_DIV_1) /* PCLKC Div /1 */
16+
#define BSP_CFG_PCLKD_DIV (BSP_CLOCKS_SYS_CLOCK_DIV_1) /* PCLKD Div /1 */
17+
#define BSP_CFG_FCLK_DIV (BSP_CLOCKS_SYS_CLOCK_DIV_2) /* FCLK Div /2 */
18+
#define BSP_CFG_CLKOUT_SOURCE (BSP_CLOCKS_CLOCK_DISABLED) /* CLKOUT Src: SUBCLK */
19+
#define BSP_CFG_CLKOUT_DIV (BSP_CLOCKS_SYS_CLOCK_DIV_1) /* CLKOUT Div /1 */
20+
#define BSP_CFG_UCK_SOURCE (BSP_CLOCKS_SOURCE_CLOCK_HOCO) /* UCLK Src: HOCO */
21+
#endif /* BSP_CLOCK_CFG_H_ */
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
RAM_START = 0x20000000;
2+
RAM_LENGTH = 0x8000;
3+
FLASH_START = 0x00000000;
4+
FLASH_LENGTH = 0x40000;
5+
DATA_FLASH_START = 0x40100000;
6+
DATA_FLASH_LENGTH = 0x2000;
7+
OPTION_SETTING_START = 0x00000000;
8+
OPTION_SETTING_LENGTH = 0x0;
9+
OPTION_SETTING_S_START = 0x80000000;
10+
OPTION_SETTING_S_LENGTH = 0x0;
11+
ID_CODE_START = 0x01010018;
12+
ID_CODE_LENGTH = 0x20;
13+
SDRAM_START = 0x80010000;
14+
SDRAM_LENGTH = 0x0;
15+
QSPI_FLASH_START = 0x60000000;
16+
QSPI_FLASH_LENGTH = 0x0;
17+
OSPI_DEVICE_0_START = 0x80020000;
18+
OSPI_DEVICE_0_LENGTH = 0x0;
19+
OSPI_DEVICE_1_START = 0x80030000;
20+
OSPI_DEVICE_1_LENGTH = 0x0;
21+
22+
/* Uno R4 has bootloader */
23+
FLASH_IMAGE_START = 0x4000;
24+
25+
INCLUDE fsp.ld

0 commit comments

Comments
 (0)