Skip to content

Commit feb58eb

Browse files
committed
add uno r4 wih FLASH_IMAGE_START=0x4000, running but interrupt (systick) does not seems to work
1 parent e56d544 commit feb58eb

File tree

15 files changed

+272
-13
lines changed

15 files changed

+272
-13
lines changed

.idea/runConfigurations/ra4m1.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/ra6m1.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/ra6m5.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hw/bsp/ra/boards/ra4m1_ek/fsp_cfg/bsp/bsp_mcu_family_cfg.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
#define BSP_MOCO_HZ (8000000)
1313
#define BSP_SUB_CLOCK_HZ (32768)
1414
#if BSP_CFG_HOCO_FREQUENCY == 0
15-
#define BSP_HOCO_HZ (24000000)
15+
#define BSP_HOCO_HZ (24000000)
1616
#elif BSP_CFG_HOCO_FREQUENCY == 2
17-
#define BSP_HOCO_HZ (32000000)
18-
#elif BSP_CFG_HOCO_FREQUENCY == 4
19-
#define BSP_HOCO_HZ (48000000)
20-
#elif BSP_CFG_HOCO_FREQUENCY == 5
21-
#define BSP_HOCO_HZ (64000000)
22-
#else
23-
#error "Invalid HOCO frequency chosen (BSP_CFG_HOCO_FREQUENCY) in bsp_clock_cfg.h"
24-
#endif
17+
#define BSP_HOCO_HZ (32000000)
18+
#elif BSP_CFG_HOCO_FREQUENCY == 4
19+
#define BSP_HOCO_HZ (48000000)
20+
#elif BSP_CFG_HOCO_FREQUENCY == 5
21+
#define BSP_HOCO_HZ (64000000)
22+
#else
23+
#error "Invalid HOCO frequency chosen (BSP_CFG_HOCO_FREQUENCY) in bsp_clock_cfg.h"
24+
#endif
2525
#define BSP_CORTEX_VECTOR_TABLE_ENTRIES (16U)
2626
#define BSP_VECTOR_TABLE_MAX_ENTRIES (48U)
2727

hw/bsp/ra/boards/uno_r4/board.cmake

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()

hw/bsp/ra/boards/uno_r4/board.h

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

hw/bsp/ra/boards/uno_r4/board.mk

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_ */

0 commit comments

Comments
 (0)