Skip to content

Commit e6762ef

Browse files
committed
Test compile for digispark-pro
1 parent ec5c61b commit e6762ef

File tree

23 files changed

+118
-2248
lines changed

23 files changed

+118
-2248
lines changed

.github/workflows/TestCompile.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ jobs:
3737
# You may add a suffix behind the fqbn with "|" to specify one board for e.g. different compile options like arduino:avr:uno|trace
3838
#############################################################################################################
3939
arduino-boards-fqbn:
40-
- digistump:avr:digispark-tiny16
40+
# - digistump:avr:digispark-tiny # ATtiny85 board @16.5 MHz
41+
- digistump:avr:digispark-tiny16 # ATtiny85 board @16 MHz
42+
- digistump:avr:digispark-pro
4143

4244
# Specify parameters for each board.
4345
# With examples-exclude you may exclude specific examples for a board. Use a comma separated list.

digistump-avr-1.6.8.zip

-30.6 KB
Binary file not shown.

digistump-avr/libraries/DigisparkCDC/Readme.txt

+23-8
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ CPU CORE CLOCK FREQUENCY
4949
========================
5050
We supply assembler modules for clock frequencies of 12 MHz, 12.8 MHz, 15 MHz,
5151
16 MHz, 16.5 MHz 18 MHz and 20 MHz. Other clock rates are not supported. The
52-
actual clock rate must be configured in usbdrv.h.
52+
actual clock rate must be configured in usbconfig.h.
5353

5454
12 MHz Clock
5555
This is the traditional clock rate of V-USB because it's the lowest clock
@@ -113,13 +113,28 @@ IDs. See http://www.obdev.at/vusb/ for details.
113113
DEVELOPMENT SYSTEM
114114
==================
115115
This driver has been developed and optimized for the GNU compiler version 3
116-
(gcc 3). It does work well with gcc 4, but with bigger code size. We recommend
117-
that you use the GNU compiler suite because it is freely available. V-USB
118-
has also been ported to the IAR compiler and assembler. It has been tested
119-
with IAR 4.10B/W32 and 4.12A/W32 on an ATmega8 with the "small" and "tiny"
120-
memory model. Not every release is tested with IAR CC and the driver may
121-
therefore fail to compile with IAR. Please note that gcc is more efficient for
122-
usbdrv.c because this module has been deliberately optimized for gcc.
116+
and 4. We recommend that you use the GNU compiler suite because it is freely
117+
available. V-USB has also been ported to the IAR compiler and assembler. It
118+
has been tested with IAR 4.10B/W32 and 4.12A/W32 on an ATmega8 with the
119+
"small" and "tiny" memory model. Not every release is tested with IAR CC and
120+
the driver may therefore fail to compile with IAR. Please note that gcc is
121+
more efficient for usbdrv.c because this module has been deliberately
122+
optimized for gcc.
123+
124+
Gcc version 3 produces smaller code than version 4 due to new optimizing
125+
capabilities which don't always improve things on 8 bit CPUs. The code size
126+
generated by gcc 4 can be reduced with the compiler options
127+
-fno-move-loop-invariants, -fno-tree-scev-cprop and
128+
-fno-inline-small-functions in addition to -Os. On devices with more than
129+
8k of flash memory, we also recommend the linker option --relax (written as
130+
-Wl,--relax for gcc) to convert absolute calls into relative where possible.
131+
132+
For more information about optimizing options see:
133+
134+
http://www.tty1.net/blog/2008-04-29-avr-gcc-optimisations_en.html
135+
136+
These optimizations are good for gcc 4.x. Version 3.x of gcc does not support
137+
most of these options and produces good code anyway.
123138

124139

125140
USING V-USB FOR FREE

digistump-avr/libraries/DigisparkCDC/usbdrv.c

+10-4
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,10 @@ uchar usbCurrentDataToken;/* when we check data toggling to ignore duplica
4545
#endif
4646

4747
/* USB status registers / not shared with asm code */
48-
const uchar *usbMsgPtr; /* data to transmit next -- ROM or RAM address */
48+
uchar *usbMsgPtr; /* data to transmit next -- ROM or RAM address */
4949
static usbMsgLen_t usbMsgLen = USB_NO_MSG; /* remaining number of bytes */
50-
static uchar usbMsgFlags; /* flag values see below */
50+
uchar usbMsgFlags; /* flag values see USB_FLG_* */
5151

52-
#define USB_FLG_MSGPTR_IS_ROM (1<<6)
5352
#define USB_FLG_USE_USER_RW (1<<7)
5453

5554
/*
@@ -335,6 +334,9 @@ uchar flags = USB_FLG_MSGPTR_IS_ROM;
335334
GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER, usbDescriptorStringSerialNumber)
336335
SWITCH_DEFAULT
337336
if(USB_CFG_DESCR_PROPS_UNKNOWN & USB_PROP_IS_DYNAMIC){
337+
if(USB_CFG_DESCR_PROPS_UNKNOWN & USB_PROP_IS_RAM){
338+
flags = 0;
339+
}
338340
len = usbFunctionDescriptor(rq);
339341
}
340342
SWITCH_END
@@ -347,6 +349,9 @@ uchar flags = USB_FLG_MSGPTR_IS_ROM;
347349
#endif
348350
SWITCH_DEFAULT
349351
if(USB_CFG_DESCR_PROPS_UNKNOWN & USB_PROP_IS_DYNAMIC){
352+
if(USB_CFG_DESCR_PROPS_UNKNOWN & USB_PROP_IS_RAM){
353+
flags = 0;
354+
}
350355
len = usbFunctionDescriptor(rq);
351356
}
352357
SWITCH_END
@@ -498,7 +503,8 @@ static uchar usbDeviceRead(uchar *data, uchar len)
498503
}else
499504
#endif
500505
{
501-
uchar i = len, *r = usbMsgPtr;
506+
uchar i = len;
507+
usbMsgPtr_t r = usbMsgPtr;
502508
if(usbMsgFlags & USB_FLG_MSGPTR_IS_ROM){ /* ROM data */
503509
do{
504510
uchar c = USB_READ_FLASH(r); /* assign to char size variable to enforce byte ops */

digistump-avr/libraries/DigisparkCDC/usbdrv.h

+22-2
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,17 @@ USB messages, even if they address another (low-speed) device on the same bus.
164164
*/
165165
#define USB_NO_MSG ((usbMsgLen_t)-1) /* constant meaning "no message" */
166166

167+
#ifndef usbMsgPtr_t
168+
#define usbMsgPtr_t uchar *
169+
#endif
170+
/* Making usbMsgPtr_t a define allows the user of this library to define it to
171+
* an 8 bit type on tiny devices. This reduces code size, especially if the
172+
* compiler supports a tiny memory model.
173+
* The type can be a pointer or scalar type, casts are made where necessary.
174+
* Although it's paradoxical, Gcc 4 generates slightly better code for scalar
175+
* types than for pointers.
176+
*/
177+
167178
struct usbRequest; /* forward declaration */
168179

169180
#ifdef __cplusplus
@@ -182,11 +193,20 @@ USB_PUBLIC void usbPoll(void);
182193
* Please note that debug outputs through the UART take ~ 0.5ms per byte
183194
* at 19200 bps.
184195
*/
185-
extern const uchar *usbMsgPtr;
196+
extern uchar *usbMsgPtr;
186197
/* This variable may be used to pass transmit data to the driver from the
187198
* implementation of usbFunctionWrite(). It is also used internally by the
188199
* driver for standard control requests.
189200
*/
201+
202+
extern uchar usbMsgFlags; /* flag values see USB_FLG_* */
203+
/* Can be set to `USB_FLG_MSGPTR_IS_ROM` in `usbFunctionSetup()` or
204+
* `usbFunctionDescriptor()` if `usbMsgPtr` has been set to a flash memory
205+
* address.
206+
*/
207+
208+
#define USB_FLG_MSGPTR_IS_ROM (1<<6)
209+
190210
USB_PUBLIC usbMsgLen_t usbFunctionSetup(uchar data[8]);
191211
/* This function is called when the driver receives a SETUP transaction from
192212
* the host which is not answered by the driver itself (in practice: class and
@@ -335,7 +355,7 @@ extern unsigned usbCrc16Append(unsigned data, uchar len);
335355
* bytes.
336356
*/
337357
#if USB_CFG_HAVE_MEASURE_FRAME_LENGTH
338-
extern unsigned usbMeasureFrameLength(void);
358+
extern unsigned usbMeasureFrameLength(void); // defined in usbdrvasm.S
339359
/* This function MUST be called IMMEDIATELY AFTER USB reset and measures 1/7 of
340360
* the number of CPU cycles during one USB frame minus one low speed bit
341361
* length. In other words: return value = 1499 * (F_CPU / 10.5 MHz)

digistump-avr/libraries/DigisparkIRLib/CHANGELOG.txt

-16
This file was deleted.

0 commit comments

Comments
 (0)