Skip to content

Commit a094156

Browse files
committed
Add RMC-RA4M1(rev.2.0)
1 parent e9d112e commit a094156

File tree

420 files changed

+497028
-1958
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

420 files changed

+497028
-1958
lines changed

boards.txt

+49
Original file line numberDiff line numberDiff line change
@@ -303,3 +303,52 @@ muxto.upload.maximum_size=262144
303303
muxto.upload.maximum_data_size=32768
304304

305305
##############################################################
306+
307+
rmc_ra4m1_20.name=Arduino RMC-RA4M1(rev.2.0)
308+
rmc_ra4m1_20.build.core=arduino
309+
rmc_ra4m1_20.build.crossprefix=arm-none-eabi-
310+
rmc_ra4m1_20.build.compiler_path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
311+
312+
rmc_ra4m1_20.build.variant=rmc_ra4m1_20
313+
rmc_ra4m1_20.build.mcu=cortex-m4
314+
rmc_ra4m1_20.build.architecture=cortex-m4
315+
rmc_ra4m1_20.build.fpu=-mfpu=fpv4-sp-d16
316+
rmc_ra4m1_20.build.float-abi=-mfloat-abi=hard
317+
318+
rmc_ra4m1_20.build.board=rmc_ra4m1_20
319+
rmc_ra4m1_20.build.defines=-DF_CPU=48000000 -DARDUINO_UNOR4_MINIMA
320+
rmc_ra4m1_20.vid.0=0x2341
321+
rmc_ra4m1_20.pid.0=0x0069
322+
rmc_ra4m1_20.vid.1=0x2341
323+
rmc_ra4m1_20.pid.1=0x0369
324+
rmc_ra4m1_20.upload_port.0.vid=0x2341
325+
rmc_ra4m1_20.upload_port.0.pid=0x0069
326+
rmc_ra4m1_20.upload_port.1.vid=0x2341
327+
rmc_ra4m1_20.upload_port.1.pid=0x0369
328+
329+
rmc_ra4m1_20.compiler.fsp.defines={build.variant.path}/defines.txt
330+
rmc_ra4m1_20.compiler.fsp.ldflags={build.variant.path}/ldflags.txt
331+
rmc_ra4m1_20.compiler.fsp.cflags=-mthumb "@{compiler.fsp.defines}"
332+
rmc_ra4m1_20.compiler.fsp.cxxflags=-mthumb "@{compiler.fsp.defines}"
333+
rmc_ra4m1_20.compiler.tinyusb.cflags=-DCFG_TUSB_MCU=OPT_MCU_RAXXX
334+
rmc_ra4m1_20.compiler.tinyusb.cxxflags=-DCFG_TUSB_MCU=OPT_MCU_RAXXX
335+
rmc_ra4m1_20.compiler.fsp.includes={build.variant.path}/includes.txt
336+
rmc_ra4m1_20.compiler.fsp.extra_ldflags=--specs=nano.specs -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys
337+
rmc_ra4m1_20.compiler.fsp="{build.variant.path}/libs/libfsp.a"
338+
339+
rmc_ra4m1_20.upload.tool=dfu-util
340+
rmc_ra4m1_20.upload.tool.default=dfu-util
341+
rmc_ra4m1_20.upload.protocol=
342+
rmc_ra4m1_20.upload.transport=
343+
rmc_ra4m1_20.upload.vid=0x2341
344+
rmc_ra4m1_20.upload.pid=0x0369
345+
rmc_ra4m1_20.upload.address=0x00010000
346+
rmc_ra4m1_20.upload.interface=0
347+
rmc_ra4m1_20.upload.use_1200bps_touch=false
348+
rmc_ra4m1_20.upload.wait_for_upload_port=false
349+
rmc_ra4m1_20.upload.native_usb=true
350+
rmc_ra4m1_20.upload.maximum_size=262144
351+
rmc_ra4m1_20.upload.maximum_data_size=32768
352+
353+
##############################################################
354+

cores/arduino/Arduino.h

+4
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ float analogReference();
121121
#define IOPORT_PRV_PORT_OFFSET (8U)
122122
#define BSP_IO_PRV_8BIT_MASK (0xFF)
123123

124+
#ifndef SDCARD_SPI
125+
#define SDCARD_SPI SPI
126+
#endif
127+
124128
#include "pins_arduino.h"
125129
#include "usb/USB.h"
126130

cores/arduino/FspTimer.cpp

+8-42
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ bool FspTimer::force_pwm_reserved = false;
1111
TimerAvail_t FspTimer::gpt_used_channel[GPT_HOWMANY] = { TIMER_FREE };
1212
TimerAvail_t FspTimer::agt_used_channel[AGT_HOWMANY] = { TIMER_FREE };
1313

14-
FspTimer::FspTimer(): init_ok(false), agt_timer(nullptr), gpt_timer(nullptr), type(GPT_TIMER), _period_buffer(true) {
14+
FspTimer::FspTimer(): init_ok(false), agt_timer(nullptr), gpt_timer(nullptr), type(GPT_TIMER) {
1515
// AGT0 is always used for timekeeping (millis() and micros())
1616
// agt_used_channel[0] = TIMER_USED;
1717
timer_cfg.cycle_end_irq = FSP_INVALID_VECTOR;
@@ -380,11 +380,13 @@ bool FspTimer::set_pulse_ms(double ms,TimerPWMChannel_t pwm_ch) {
380380
freq_hz = R_FSP_SystemClockHzGet(FSP_PRIV_CLOCK_PCLKB) >> timer_cfg.source_div;
381381
}
382382

383-
uint32_t pulse_counts_ms = (uint32_t) ((uint64_t) (freq_hz * ms)/1000);
383+
uint32_t pulse_counts_ms = (uint32_t) ((uint64_t) freq_hz/1000 * ms);
384384
if(!set_duty_cycle(pulse_counts_ms, pwm_ch)) {
385385
return false;
386386
}
387-
return true;
387+
388+
return true;
389+
388390
}
389391

390392
/* -------------------------------------------------------------------------- */
@@ -397,11 +399,12 @@ bool FspTimer::set_pulse_us(double us,TimerPWMChannel_t pwm_ch) {
397399
else if(type == AGT_TIMER){
398400
freq_hz = R_FSP_SystemClockHzGet(FSP_PRIV_CLOCK_PCLKB) >> timer_cfg.source_div;
399401
}
400-
401-
uint32_t pulse_counts_us = (uint32_t) ((uint64_t) (freq_hz * us)/1000000 );
402+
403+
uint32_t pulse_counts_us = (uint32_t) ((uint64_t) freq_hz/1000000 * us);
402404
if(!set_duty_cycle(pulse_counts_us, pwm_ch)) {
403405
return false;
404406
}
407+
405408
return true;
406409
}
407410

@@ -450,15 +453,9 @@ bool FspTimer::set_period(uint32_t p) {
450453
/* -------------------------------------------------------------------------- */
451454

452455
if(type == GPT_TIMER && gpt_timer != nullptr) {
453-
if (_period_buffer) {
454456
if (R_GPT_PeriodSet(&(gpt_timer->ctrl), p) != FSP_SUCCESS) {
455457
return false;
456458
}
457-
}
458-
else {
459-
// Not buffered set it directly
460-
gpt_timer->ctrl.p_reg->GTPR = p;
461-
}
462459
}
463460
else if(type == AGT_TIMER && agt_timer != nullptr) {
464461
if (R_AGT_PeriodSet(&(agt_timer->ctrl), p) != FSP_SUCCESS) {
@@ -473,37 +470,6 @@ bool FspTimer::set_period(uint32_t p) {
473470

474471

475472

476-
/* -------------------------------------------------------------------------- */
477-
bool FspTimer::set_period_buffer(bool period_buffer) {
478-
/* -------------------------------------------------------------------------- */
479-
480-
if (_period_buffer == (uint8_t)period_buffer) {
481-
return true;
482-
}
483-
484-
_period_buffer = (uint8_t)period_buffer;
485-
if(type == GPT_TIMER && gpt_timer != nullptr) {
486-
487-
if (period_buffer) {
488-
gpt_timer->ctrl.p_reg->GTBER_b.PR = 1;
489-
gpt_timer->ctrl.p_reg->GTBER_b.BD1 = 0;
490-
}
491-
else {
492-
gpt_timer->ctrl.p_reg->GTBER_b.PR = 0;
493-
gpt_timer->ctrl.p_reg->GTBER_b.BD1 = 1;
494-
}
495-
}
496-
else if(type == AGT_TIMER && agt_timer != nullptr) {
497-
// not buffered..
498-
}
499-
else {
500-
return false;
501-
}
502-
return true;
503-
}
504-
505-
506-
507473
/* -------------------------------------------------------------------------- */
508474
bool FspTimer::open() {
509475
/* -------------------------------------------------------------------------- */

cores/arduino/FspTimer.h

-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ class FspTimer {
9595
uint32_t _duty_cycle_counts;
9696
timer_source_div_t _sd;
9797
uint8_t type;
98-
uint8_t _period_buffer;
9998
void set_period_counts(uint8_t tp, float period, uint32_t max);
10099
TimerIrqCfg_t get_cfg_for_irq();
101100
static bool force_pwm_reserved;
@@ -112,7 +111,6 @@ class FspTimer {
112111
bool reset();
113112
bool set_duty_cycle(uint32_t const duty_cycle_counts, TimerPWMChannel_t pwm_ch);
114113
bool set_period(uint32_t p);
115-
bool set_period_buffer(bool period_buffer);
116114
bool close();
117115
void enable_pwm_channel(TimerPWMChannel_t pwm_channel);
118116
uint32_t get_counter();

0 commit comments

Comments
 (0)