1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

Modify the linker script to move some code into flash, enable -mtext-section-literals

This commit is contained in:
Ivan Grokhotkov 2014-12-02 00:46:57 +03:00
parent 03f35e44f0
commit 2d9c5d8297
12 changed files with 33 additions and 79 deletions

View File

@ -17,19 +17,39 @@
*/ */
#include <stdlib.h> #include <stdlib.h>
extern "C" {
#include "ets_sys.h"
#include "os_type.h"
#include "osapi.h"
#include "mem.h"
#include "user_interface.h"
}
void *operator new(size_t size) {
return os_malloc(size);
}
void *operator new[](size_t size) {
return os_malloc(size);
}
void operator delete(void * ptr) {
os_free(ptr);
}
void operator delete[](void * ptr) {
os_free(ptr);
}
extern "C" void __cxa_pure_virtual(void) __attribute__ ((__noreturn__)); extern "C" void __cxa_pure_virtual(void) __attribute__ ((__noreturn__));
extern "C" void __cxa_deleted_virtual(void) __attribute__ ((__noreturn__)); extern "C" void __cxa_deleted_virtual(void) __attribute__ ((__noreturn__));
void __cxa_pure_virtual(void) { void __cxa_pure_virtual(void) {
// We might want to write some diagnostics to uart in this case
//std::terminate();
abort(); abort();
} }
void __cxa_deleted_virtual(void) { void __cxa_deleted_virtual(void) {
// We might want to write some diagnostics to uart in this case
//std::terminate();
abort(); abort();
} }

View File

@ -27,6 +27,7 @@
#define ARDUINO_MAIN #define ARDUINO_MAIN
#include "wiring_private.h" #include "wiring_private.h"
#include "pins_arduino.h" #include "pins_arduino.h"
#include "c_types.h"
#include "eagle_soc.h" #include "eagle_soc.h"
#include "gpio.h" #include "gpio.h"
@ -68,6 +69,12 @@ static const uint32_t g_pin_funcs[PINCOUNT] = {
}; };
enum PinFunction { GPIO, PWM };
static uint32_t g_gpio_function[PINCOUNT] = {
GPIO
};
void pinMode(uint8_t pin, uint8_t mode) void pinMode(uint8_t pin, uint8_t mode)
{ {
uint32_t mux = g_pin_muxes[pin]; uint32_t mux = g_pin_muxes[pin];

View File

@ -1,43 +0,0 @@
/*
Copyright (c) 2014 Arduino. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdlib.h>
extern "C" {
#include "ets_sys.h"
#include "os_type.h"
#include "osapi.h"
#include "mem.h"
#include "user_interface.h"
}
void *operator new(size_t size) {
return os_malloc(size);
}
void *operator new[](size_t size) {
return os_malloc(size);
}
void operator delete(void * ptr) {
os_free(ptr);
}
void operator delete[](void * ptr) {
os_free(ptr);
}

View File

@ -1,30 +0,0 @@
/*
Copyright (c) 2014 Arduino. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef NEW_H
#define NEW_H
#include <stdlib.h>
void * operator new(size_t size);
void * operator new[](size_t size);
void operator delete(void * ptr);
void operator delete[](void * ptr);
#endif

View File

@ -15,7 +15,7 @@ compiler.sdk.path={compiler.tools.path}/sdk/
compiler.cpreprocessor.flags=-D__ets__ -DICACHE_FLASH -I{compiler.sdk.path}/include compiler.cpreprocessor.flags=-D__ets__ -DICACHE_FLASH -I{compiler.sdk.path}/include
compiler.c.cmd=xtensa-lx106-elf-gcc compiler.c.cmd=xtensa-lx106-elf-gcc
compiler.c.flags=-c -Os -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -MMD -std=c99 compiler.c.flags=-c -Os -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -MMD -std=c99
compiler.c.elf.ldscript=eagle.app.v6.ld compiler.c.elf.ldscript=eagle.app.v6.ld
compiler.c.elf.flags=-nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static -L{compiler.sdk.path}/lib -L{compiler.sdk.path}/ld -T{compiler.c.elf.ldscript} compiler.c.elf.flags=-nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static -L{compiler.sdk.path}/lib -L{compiler.sdk.path}/ld -T{compiler.c.elf.ldscript}
@ -23,7 +23,7 @@ compiler.c.elf.cmd=xtensa-lx106-elf-gcc
compiler.c.elf.libs=-lc -lgcc -lhal -lphy -lnet80211 -llwip -lwpa -lmain compiler.c.elf.libs=-lc -lgcc -lhal -lphy -lnet80211 -llwip -lwpa -lmain
compiler.cpp.cmd=xtensa-lx106-elf-g++ compiler.cpp.cmd=xtensa-lx106-elf-g++
compiler.cpp.flags=-c -Os -mlongcalls -fno-exceptions -fno-rtti -std=c++11 -MMD compiler.cpp.flags=-c -Os -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -std=c++11 -MMD
compiler.as.cmd=xtensa-lx106-elf-as compiler.as.cmd=xtensa-lx106-elf-as