Skip to content

Commit 83e1ac9

Browse files
committed
update to core code to support xmega128a1, bug fixes
1 parent e9f38dd commit 83e1ac9

File tree

4 files changed

+433
-365
lines changed

4 files changed

+433
-365
lines changed

cores/xmega/main.cpp

+17-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,21 @@
1919

2020
#include <Arduino.h>
2121

22+
#ifdef EIND
23+
// if I have an EIND register, I want it pre-loaded with the correct value
24+
// for info on THIS thing, see http://gcc.gnu.org/onlinedocs/gcc/AVR-Options.html
25+
// in essence, 'init3' section functions run just before 'main()'
26+
27+
// must prototype it to get all of the attributes
28+
static void __attribute__((section(".init3"),naked,used,no_instrument_function)) init3_set_eind (void);
29+
30+
void init3_set_eind (void)
31+
{
32+
__asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
33+
"out %i0,r24" :: "n" (&EIND) : "r24","memory");
34+
}
35+
#endif // EIND
36+
2237
//Declared weak in Arduino.h to allow user redefinitions.
2338
int atexit(void (*func)()) { return 0; }
2439

@@ -29,12 +44,13 @@ void initVariant() { }
2944

3045
int main(void)
3146
{
47+
3248
init();
3349

3450
initVariant();
3551

3652
#if defined(USBCON)
37-
USBDevice.attach();
53+
USBDevice.attach();
3854
#endif
3955

4056
setup();

0 commit comments

Comments
 (0)