1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-16 11:21:18 +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 d3359d3670
commit f788022730
13 changed files with 43 additions and 85 deletions

View File

@ -17,19 +17,39 @@
*/
#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_deleted_virtual(void) __attribute__ ((__noreturn__));
void __cxa_pure_virtual(void) {
// We might want to write some diagnostics to uart in this case
//std::terminate();
abort();
}
void __cxa_deleted_virtual(void) {
// We might want to write some diagnostics to uart in this case
//std::terminate();
abort();
}

View File

@ -27,6 +27,7 @@
#define ARDUINO_MAIN
#include "wiring_private.h"
#include "pins_arduino.h"
#include "c_types.h"
#include "eagle_soc.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)
{
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.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.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.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

View File

@ -148,6 +148,15 @@ SECTIONS
} >dram0_0_seg :dram0_0_bss_phdr
/* __stack = 0x3ffc8000; */
.irom0.text : ALIGN(4)
{
_irom0_text_start = ABSOLUTE(.);
*core_esp8266_*.o(.literal*, .text*)
*.cpp.o(.literal*, .text*)
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
_irom0_text_end = ABSOLUTE(.);
} >irom0_0_seg :irom0_0_phdr
.text : ALIGN(4)
{
_stext = .;
@ -172,12 +181,7 @@ SECTIONS
_lit4_end = ABSOLUTE(.);
} >iram1_0_seg :iram1_0_phdr
.irom0.text : ALIGN(4)
{
_irom0_text_start = ABSOLUTE(.);
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
_irom0_text_end = ABSOLUTE(.);
} >irom0_0_seg :irom0_0_phdr
}
/* get ROM code address */