Skip to content

Commit e809bb2

Browse files
author
Jim Lindblom
committed
updating cores, platform to cooperate with samd 1.6.9
1 parent 944a4da commit e809bb2

File tree

8 files changed

+33
-46
lines changed

8 files changed

+33
-46
lines changed

sparkfun/samd/cores/arduino/SERCOM.cpp

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -300,24 +300,11 @@ void SERCOM::setClockModeSPI(SercomSpiClockMode clockMode)
300300
enableSPI();
301301
}
302302

303-
void SERCOM::writeDataSPI(uint8_t data)
303+
uint8_t SERCOM::transferDataSPI(uint8_t data)
304304
{
305-
while( sercom->SPI.INTFLAG.bit.DRE == 0 )
306-
{
307-
// Waiting Data Registry Empty
308-
}
309-
310305
sercom->SPI.DATA.bit.DATA = data; // Writing data into Data register
311306

312-
while( sercom->SPI.INTFLAG.bit.TXC == 0 || sercom->SPI.INTFLAG.bit.DRE == 0 )
313-
{
314-
// Waiting Complete Transmission
315-
}
316-
}
317-
318-
uint16_t SERCOM::readDataSPI()
319-
{
320-
while( sercom->SPI.INTFLAG.bit.DRE == 0 || sercom->SPI.INTFLAG.bit.RXC == 0 )
307+
while( sercom->SPI.INTFLAG.bit.RXC == 0 )
321308
{
322309
// Waiting Complete Reception
323310
}

sparkfun/samd/cores/arduino/SERCOM.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,7 @@ class SERCOM
175175
SercomDataOrder getDataOrderSPI( void ) ;
176176
void setBaudrateSPI(uint8_t divider) ;
177177
void setClockModeSPI(SercomSpiClockMode clockMode) ;
178-
void writeDataSPI(uint8_t data) ;
179-
uint16_t readDataSPI( void ) ;
178+
uint8_t transferDataSPI(uint8_t data) ;
180179
bool isBufferOverflowErrorSPI( void ) ;
181180
bool isDataRegisterEmptySPI( void ) ;
182181
bool isTransmitCompleteSPI( void ) ;

sparkfun/samd/cores/arduino/USB/SAMD21_USBDevice.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ class USBDevice_SAMD21G18x {
9191
inline uint16_t epInterruptSummary() { return usb.EPINTSMRY.reg; }
9292

9393
inline bool epBank0IsSetupReceived(ep_t ep) { return usb.DeviceEndpoint[ep].EPINTFLAG.bit.RXSTP; }
94-
inline bool epBank0IsStalled(ep_t ep) { return usb.DeviceEndpoint[ep].EPINTFLAG.bit.STALL & 1; }
95-
inline bool epBank1IsStalled(ep_t ep) { return usb.DeviceEndpoint[ep].EPINTFLAG.bit.STALL & 2; }
96-
inline bool epBank0IsTransferComplete(ep_t ep) { return usb.DeviceEndpoint[ep].EPINTFLAG.bit.TRCPT & 1; }
97-
inline bool epBank1IsTransferComplete(ep_t ep) { return usb.DeviceEndpoint[ep].EPINTFLAG.bit.TRCPT & 2; }
94+
inline bool epBank0IsStalled(ep_t ep) { return usb.DeviceEndpoint[ep].EPINTFLAG.bit.STALL0; }
95+
inline bool epBank1IsStalled(ep_t ep) { return usb.DeviceEndpoint[ep].EPINTFLAG.bit.STALL1; }
96+
inline bool epBank0IsTransferComplete(ep_t ep) { return usb.DeviceEndpoint[ep].EPINTFLAG.bit.TRCPT0; }
97+
inline bool epBank1IsTransferComplete(ep_t ep) { return usb.DeviceEndpoint[ep].EPINTFLAG.bit.TRCPT1; }
9898

9999
inline void epBank0AckSetupReceived(ep_t ep) { usb.DeviceEndpoint[ep].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_RXSTP; }
100100
inline void epBank0AckStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_STALL(1); }
@@ -103,16 +103,16 @@ class USBDevice_SAMD21G18x {
103103
inline void epBank1AckTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_TRCPT(2); }
104104

105105
inline void epBank0EnableSetupReceived(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.RXSTP = 1; }
106-
inline void epBank0EnableStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.STALL = 1; }
107-
inline void epBank1EnableStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.STALL = 2; }
108-
inline void epBank0EnableTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.TRCPT = 1; }
109-
inline void epBank1EnableTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.TRCPT = 2; }
106+
inline void epBank0EnableStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.STALL0 = 1; }
107+
inline void epBank1EnableStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.STALL1 = 1; }
108+
inline void epBank0EnableTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.TRCPT0 = 1; }
109+
inline void epBank1EnableTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENSET.bit.TRCPT0 = 1; }
110110

111111
inline void epBank0DisableSetupReceived(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.RXSTP = 1; }
112-
inline void epBank0DisableStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.STALL = 1; }
113-
inline void epBank1DisableStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.STALL = 2; }
114-
inline void epBank0DisableTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.TRCPT = 1; }
115-
inline void epBank1DisableTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.TRCPT = 2; }
112+
inline void epBank0DisableStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.STALL0 = 1; }
113+
inline void epBank1DisableStalled(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.STALL1 = 1; }
114+
inline void epBank0DisableTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.TRCPT0 = 1; }
115+
inline void epBank1DisableTransferComplete(ep_t ep) { usb.DeviceEndpoint[ep].EPINTENCLR.bit.TRCPT1 = 1; }
116116

117117
// Status
118118
inline bool epBank0IsReady(ep_t ep) { return usb.DeviceEndpoint[ep].EPSTATUS.bit.BK0RDY; }
@@ -122,10 +122,10 @@ class USBDevice_SAMD21G18x {
122122
inline void epBank0ResetReady(ep_t ep) { usb.DeviceEndpoint[ep].EPSTATUSCLR.bit.BK0RDY = 1; }
123123
inline void epBank1ResetReady(ep_t ep) { usb.DeviceEndpoint[ep].EPSTATUSCLR.bit.BK1RDY = 1; }
124124

125-
inline void epBank0SetStallReq(ep_t ep) { usb.DeviceEndpoint[ep].EPSTATUSSET.bit.STALLRQ = 1; }
126-
inline void epBank1SetStallReq(ep_t ep) { usb.DeviceEndpoint[ep].EPSTATUSSET.bit.STALLRQ = 2; }
127-
inline void epBank0ResetStallReq(ep_t ep) { usb.DeviceEndpoint[ep].EPSTATUSCLR.bit.STALLRQ = 1; }
128-
inline void epBank1ResetStallReq(ep_t ep) { usb.DeviceEndpoint[ep].EPSTATUSCLR.bit.STALLRQ = 2; }
125+
inline void epBank0SetStallReq(ep_t ep) { usb.DeviceEndpoint[ep].EPSTATUSSET.bit.STALLRQ0 = 1; }
126+
inline void epBank1SetStallReq(ep_t ep) { usb.DeviceEndpoint[ep].EPSTATUSSET.bit.STALLRQ1 = 1; }
127+
inline void epBank0ResetStallReq(ep_t ep) { usb.DeviceEndpoint[ep].EPSTATUSCLR.bit.STALLRQ0 = 1; }
128+
inline void epBank1ResetStallReq(ep_t ep) { usb.DeviceEndpoint[ep].EPSTATUSCLR.bit.STALLRQ1 = 1; }
129129

130130
// Packet
131131
inline uint16_t epBank0ByteCount(ep_t ep) { return EP[ep].DeviceDescBank[0].PCKSIZE.bit.BYTE_COUNT; }

sparkfun/samd/cores/arduino/USB/samd21_host.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -463,10 +463,6 @@ void UHD_Pipe_Send(uint32_t ul_pipe, uint32_t ul_token_type)
463463
uhd_unfreeze_pipe(ul_pipe);
464464
}
465465

466-
#define USB_HOST_PINTFLAG_TRCPT_Pos 0 /**< \brief (USB_HOST_PINTFLAG) Transfer Complete 0/1 Interrupt Flag */
467-
#define USB_HOST_PINTFLAG_TRCPT_Msk (0x3u << USB_HOST_PINTFLAG_TRCPT_Pos)
468-
#define USB_HOST_PINTFLAG_TRCPT(value) ((USB_HOST_PINTFLAG_TRCPT_Msk & ((value) << USB_HOST_PINTFLAG_TRCPT_Pos)))
469-
470466
/**
471467
* \brief Check for pipe transfer completion.
472468
*

sparkfun/samd/cores/arduino/cortex_handlers.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ __attribute__ ((section(".isr_vector"))) const DeviceVectors exception_table =
130130
(void*) AC_Handler, /* 24 Analog Comparators */
131131
(void*) DAC_Handler, /* 25 Digital Analog Converter */
132132
(void*) PTC_Handler, /* 26 Peripheral Touch Controller */
133-
(void*) I2S_Handler /* 27 Inter-IC Sound Interface */
133+
(void*) I2S_Handler, /* 27 Inter-IC Sound Interface */
134+
(void*) (0UL), /* Reserved */
134135
};
135136

136137
extern int main(void);

sparkfun/samd/cores/arduino/wiring.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ void init( void )
6565
// Capture error
6666
while ( 1 ) ;
6767
}
68+
NVIC_SetPriority (SysTick_IRQn, (1 << __NVIC_PRIO_BITS) - 2); /* set Priority for Systick Interrupt (2nd lowest) */
6869

6970
// Clock PORT for Digital I/O
7071
// PM->APBBMASK.reg |= PM_APBBMASK_PORT ;

sparkfun/samd/cores/arduino/wiring_analog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ uint32_t analogRead(uint32_t pin)
165165
ADC->SWTRIG.bit.START = 1;
166166

167167
// Clear the Data Ready flag
168-
ADC->INTFLAG.bit.RESRDY = 1;
168+
ADC->INTFLAG.reg = ADC_INTFLAG_RESRDY;
169169

170170
// Start conversion again, since The first conversion after the reference is changed must not be used.
171171
syncADC();

sparkfun/samd/platform.txt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
2121

2222
name=SparkFun SAMD (32-bits ARM Cortex-M0+) Boards
23-
version=1.3.0
23+
version=1.3.1
2424

2525
# Compile variables
2626
# -----------------
@@ -62,7 +62,8 @@ compiler.S.extra_flags=
6262
compiler.ar.extra_flags=
6363
compiler.elf2hex.extra_flags=
6464

65-
compiler.arm.cmsis.path="-I{runtime.tools.CMSIS.path}/CMSIS/Include/" "-I{runtime.tools.CMSIS.path}/Device/ATMEL/"
65+
compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS.path}/CMSIS/Include/" "-I{runtime.tools.CMSIS-Atmel.path}/CMSIS/Device/ATMEL/"
66+
compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS.path}/CMSIS/Lib/GCC/" -larm_cortexM0l_math
6667

6768
# USB Flags
6869
# ---------
@@ -77,21 +78,21 @@ build.usb_manufacturer="Unknown"
7778
# ----------------
7879

7980
## Compile c files
80-
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {compiler.arm.cmsis.path} {includes} "{source_file}" -o "{object_file}"
81+
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}"
8182

8283
## Compile c++ files
83-
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {compiler.arm.cmsis.path} {includes} "{source_file}" -o "{object_file}"
84+
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}"
8485

8586
## Compile S files
86-
recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {compiler.arm.cmsis.path} {includes} "{source_file}" -o "{object_file}"
87+
recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}"
8788

8889
## Create archives
8990
# archive_file_path is needed for backwards compatibility with IDE 1.6.5 or older, IDE 1.6.6 or newer overrides this value
9091
archive_file_path={build.path}/{archive_file}
9192
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
9293

9394
## Combine gc-sections, archives, and objects
94-
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nano.specs --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} -Wl,--start-group -lm "{build.path}/{archive_file}" {build.extra_combine_flags} -Wl,--end-group
95+
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nano.specs --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} -Wl,--start-group {compiler.arm.cmsis.ldflags} -lm "{build.path}/{archive_file}" -Wl,--end-group
9596

9697
## Create output (bin file)
9798
recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin"
@@ -119,11 +120,13 @@ tools.bossac.upload.params.verbose=-i -d
119120
tools.bossac.upload.params.quiet=
120121
tools.bossac.upload.pattern="{path}/{cmd}" {upload.verbose} --port={serial.port.file} -U {upload.native_usb} -i -e -w -v "{build.path}/{build.project_name}.bin" -R
121122

123+
tools.bossac_remote.upload.pattern=/usr/bin/run-bossac {upload.verbose} --port=ttyATH0 -U {upload.native_usb} -e -w -v /tmp/sketch.bin -R
124+
122125
#
123126
# OpenOCD sketch upload
124127
#
125128

126-
tools.openocd.path={runtime.tools.openocd.path}
129+
tools.openocd.path={runtime.tools.openocd-0.9.0-arduino.path}
127130
tools.openocd.cmd=bin/openocd
128131
tools.openocd.cmd.windows=bin/openocd.exe
129132

0 commit comments

Comments
 (0)