|
|
|
|
|
|
|
|
#include "wiring.h" |
|
|
#include "wiring.h" |
|
|
#include "usb_dev.h" |
|
|
#include "usb_dev.h" |
|
|
#include "avr/pgmspace.h" |
|
|
#include "avr/pgmspace.h" |
|
|
|
|
|
#include "smalloc.h" |
|
|
|
|
|
|
|
|
#include "debug/printf.h" |
|
|
#include "debug/printf.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern unsigned long _ebss; |
|
|
extern unsigned long _ebss; |
|
|
extern unsigned long _flexram_bank_config; |
|
|
extern unsigned long _flexram_bank_config; |
|
|
extern unsigned long _estack; |
|
|
extern unsigned long _estack; |
|
|
|
|
|
extern unsigned long _extram_start; |
|
|
|
|
|
extern unsigned long _extram_end; |
|
|
|
|
|
|
|
|
__attribute__ ((used, aligned(1024))) |
|
|
__attribute__ ((used, aligned(1024))) |
|
|
void (* _VectorsRam[NVIC_NUM_INTERRUPTS+16])(void); |
|
|
void (* _VectorsRam[NVIC_NUM_INTERRUPTS+16])(void); |
|
|
|
|
|
|
|
|
extern void __libc_init_array(void); // C++ standard library |
|
|
extern void __libc_init_array(void); // C++ standard library |
|
|
|
|
|
|
|
|
uint8_t external_psram_size = 0; |
|
|
uint8_t external_psram_size = 0; |
|
|
|
|
|
#ifdef ARDUINO_TEENSY41 |
|
|
|
|
|
struct smalloc_pool extmem_smalloc_pool; |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
extern int main (void); |
|
|
extern int main (void); |
|
|
void startup_default_early_hook(void) {} |
|
|
void startup_default_early_hook(void) {} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
// TODO: zero uninitialized EXTMEM variables |
|
|
// TODO: zero uninitialized EXTMEM variables |
|
|
// TODO: copy from flash to initialize EXTMEM variables |
|
|
// TODO: copy from flash to initialize EXTMEM variables |
|
|
// TODO: set up for malloc_extmem() |
|
|
|
|
|
|
|
|
sm_set_pool(&extmem_smalloc_pool, &_extram_end, |
|
|
|
|
|
external_psram_size * 0x100000 - |
|
|
|
|
|
((uint32_t)&_extram_end - (uint32_t)&_extram_start), |
|
|
|
|
|
1, NULL); |
|
|
} else { |
|
|
} else { |
|
|
// No PSRAM |
|
|
// No PSRAM |
|
|
|
|
|
memset(&extmem_smalloc_pool, 0, sizeof(extmem_smalloc_pool)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|