atmel-samd: Use link time optimization to reduce code size of builds which
share space with the file system. "Express" builds with SPI flash crash the compiler for some reason so its currently disabled for them.
This commit is contained in:
parent
3fd19c60cc
commit
062fac1d43
|
@ -115,7 +115,7 @@ CFLAGS_CORTEX_M0 = \
|
|||
-DTC_ASYNC=true \
|
||||
-DUSB_DEVICE_LPM_SUPPORT \
|
||||
--param max-inline-insns-single=500
|
||||
CFLAGS = $(INC) -Wall -Werror -std=gnu11 -nostdlib $(CFLAGS_CORTEX_M0) $(COPT)
|
||||
CFLAGS = $(INC) -Wall -Werror -std=gnu11 -nostdlib $(CFLAGS_CORTEX_M0) $(COPT) $(BOARD_CFLAGS)
|
||||
|
||||
#Debugging/Optimization
|
||||
# TODO(tannewt): Figure out what NDEBUG does. Adding it to the debug build
|
||||
|
@ -139,8 +139,8 @@ CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool
|
|||
CFLAGS += -DMICROPY_MODULE_FROZEN_MPY
|
||||
endif
|
||||
|
||||
LIBM_FILE_NAME = $(shell $(CC) $(CFLAGS) -print-file-name=libm.a)
|
||||
LDFLAGS = -mthumb -mcpu=cortex-m0plus -Lasf/thirdparty/CMSIS/Lib/GCC/ -LQTouch/ -L$(dir $(LIBM_FILE_NAME)) -Wl,-nostdlib -Wl,-T,$(LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs
|
||||
#LIBM_FILE_NAME = $(shell $(CC) $(CFLAGS) -print-file-name=libm.a)
|
||||
LDFLAGS = $(CFLAGS) -nostartfiles -fshort-enums -mthumb -mcpu=cortex-m0plus -Lasf/thirdparty/CMSIS/Lib/GCC/ -LQTouch/ -Wl,-nostdlib -Wl,-T,$(LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs
|
||||
LIBS = -larm_cortexM0l_math -lsamd21_qtouch_gcc -lm -lgcc -lc
|
||||
|
||||
SRC_ASF = $(addprefix asf/sam0/,\
|
||||
|
|
|
@ -127,7 +127,7 @@ void AC1_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler
|
|||
#endif
|
||||
|
||||
/* Exception Table */
|
||||
__attribute__ ((section(".vectors")))
|
||||
__attribute__ ((used, section(".vectors")))
|
||||
const DeviceVectors exception_table = {
|
||||
|
||||
/* Configure Initial Stack Pointer, using linker-generated symbols */
|
||||
|
@ -229,7 +229,7 @@ const DeviceVectors exception_table = {
|
|||
* \brief This is the code that gets called on processor reset.
|
||||
* To initialize the device, and call the main() routine.
|
||||
*/
|
||||
void Reset_Handler(void)
|
||||
__attribute__ ((used))void Reset_Handler(void)
|
||||
{
|
||||
uint32_t *pSrc, *pDest;
|
||||
|
||||
|
|
|
@ -5,3 +5,5 @@ USB_PID = 0x824D
|
|||
FLASH_IMPL = internal_flash.c
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
|
||||
BOARD_CFLAGS = -flto
|
||||
|
|
|
@ -5,3 +5,5 @@ USB_PID = 0x8015
|
|||
FLASH_IMPL = internal_flash.c
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
|
||||
BOARD_CFLAGS = -flto
|
||||
|
|
|
@ -5,3 +5,5 @@ USB_PID = 0x8015
|
|||
FLASH_IMPL = internal_flash.c
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
|
||||
BOARD_CFLAGS = -flto
|
||||
|
|
|
@ -5,3 +5,5 @@ USB_PID = 0x8015
|
|||
FLASH_IMPL = internal_flash.c
|
||||
|
||||
CHIP_VARIANT = SAMD21E18A
|
||||
|
||||
BOARD_CFLAGS = -flto
|
||||
|
|
|
@ -5,3 +5,5 @@ USB_PID = 0x8015
|
|||
FLASH_IMPL = internal_flash.c
|
||||
|
||||
CHIP_VARIANT = SAMD21E18A
|
||||
|
||||
BOARD_CFLAGS = -flto
|
||||
|
|
|
@ -500,7 +500,7 @@ void samd21_init(void) {
|
|||
nvm_set_config(&config_nvm);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int main(void) {
|
||||
// initialise the cpu and peripherals
|
||||
samd21_init();
|
||||
|
||||
|
|
|
@ -125,7 +125,11 @@ mp_obj_t namedtuple_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t
|
|||
return MP_OBJ_FROM_PTR(tuple);
|
||||
}
|
||||
|
||||
const mp_rom_obj_tuple_t namedtuple_base_tuple = {{&mp_type_tuple}, 1, {MP_ROM_PTR(&mp_type_tuple)}};
|
||||
const mp_rom_obj_tuple1_t namedtuple_base_tuple = {
|
||||
.base = {&mp_type_tuple},
|
||||
.len = 1u,
|
||||
.items = {MP_OBJ_FROM_PTR(&mp_type_tuple)}
|
||||
};
|
||||
|
||||
STATIC mp_obj_t mp_obj_new_namedtuple_type(qstr name, mp_uint_t n_fields, mp_obj_t *fields) {
|
||||
mp_obj_namedtuple_type_t *o = m_new_obj_var(mp_obj_namedtuple_type_t, qstr, n_fields);
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __MICROPY_INCLUDED_PY_OBJNAMEDTUPLE_H__
|
||||
#define __MICROPY_INCLUDED_PY_OBJNAMEDTUPLE_H__
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "py/nlr.h"
|
||||
|
@ -50,6 +53,8 @@ void namedtuple_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest);
|
|||
|
||||
mp_obj_t namedtuple_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args);
|
||||
|
||||
const mp_rom_obj_tuple_t namedtuple_base_tuple;
|
||||
const mp_rom_obj_tuple1_t namedtuple_base_tuple;
|
||||
|
||||
#endif // MICROPY_PY_COLLECTIONS
|
||||
|
||||
#endif // __MICROPY_INCLUDED_PY_OBJNAMEDTUPLE_H__
|
||||
|
|
|
@ -36,10 +36,18 @@ typedef struct _mp_obj_tuple_t {
|
|||
|
||||
typedef struct _mp_rom_obj_tuple_t {
|
||||
mp_obj_base_t base;
|
||||
mp_uint_t len;
|
||||
uint32_t len;
|
||||
mp_rom_obj_t items[];
|
||||
} mp_rom_obj_tuple_t;
|
||||
|
||||
// This is identical to the type above except it makes it clear that there is
|
||||
// only one item. This makes lto happy with the namedtuple_base_tuple.
|
||||
typedef struct _mp_rom_obj_tuple1_t {
|
||||
mp_obj_base_t base;
|
||||
uint32_t len;
|
||||
mp_rom_obj_t items[1];
|
||||
} mp_rom_obj_tuple1_t;
|
||||
|
||||
void mp_obj_tuple_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind);
|
||||
mp_obj_t mp_obj_tuple_unary_op(mp_uint_t op, mp_obj_t self_in);
|
||||
mp_obj_t mp_obj_tuple_binary_op(mp_uint_t op, mp_obj_t lhs, mp_obj_t rhs);
|
||||
|
|
|
@ -139,7 +139,7 @@ STATIC const mp_map_elem_t time_module_globals_table[] = {
|
|||
{ MP_OBJ_NEW_QSTR(MP_QSTR_monotonic), (mp_obj_t)&time_monotonic_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_sleep), (mp_obj_t)&time_sleep_obj },
|
||||
#if MICROPY_PY_COLLECTIONS
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_struct_time), (mp_obj_t)&struct_time_type_obj },
|
||||
//{ MP_OBJ_NEW_QSTR(MP_QSTR_struct_time), (mp_obj_t)&struct_time_type_obj },
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue