Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ ESP8266 core files are licensed under LGPL.

### Other useful links ###

[Toolchain repo](https://github.com/earlephilhower/esp-quick-toolchain)
[Toolchain repo](https://github.com/mcspr/esp-quick-toolchain)

[Newlib repo](https://github.com/mcspr/newlib-xtensa)

[Lwip link layer repo](https://github.com/d-a-v/esp82xx-nonos-linklayer)

Expand Down
102 changes: 55 additions & 47 deletions cores/esp8266/libc_replacements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,112 +24,120 @@
*/

#include <stddef.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <errno.h>
#include <string.h>
#include <../include/time.h> // See issue #6714
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <sys/reent.h>

#include "ets_sys.h"
#include "os_type.h"
#include "osapi.h"
#include "mem.h"
#include "user_interface.h"
#include "debug.h"

extern "C" {

int IRAM_ATTR _open_r (struct _reent* unused, const char *ptr, int mode) {
#include <stdio.h> // FILE
#include <stdlib.h> // abort()
#include <sys/stat.h> // struct stat
#include <unistd.h> // ..._FILENO
#include <sys/reent.h> // struct _reent

#include "ets_sys.h" // ets_...
#include "c_types.h" // IRAM_ATTR

extern "C"
{

int IRAM_ATTR _open_r(struct _reent* unused, const char* ptr, int flags, int mode)
{
(void)unused;
(void)ptr;
(void)flags;
(void)mode;
return 0;
}

int IRAM_ATTR _close_r(struct _reent* unused, int file) {
int IRAM_ATTR _close_r(struct _reent* unused, int file)
{
(void)unused;
(void)file;
return 0;
}

int IRAM_ATTR _fstat_r(struct _reent* unused, int file, struct stat *st) {
int IRAM_ATTR _fstat_r(struct _reent* unused, int file, struct stat* st)
{
(void)unused;
(void)file;
st->st_mode = S_IFCHR;
return 0;
}

int IRAM_ATTR _lseek_r(struct _reent* unused, int file, int ptr, int dir) {
_off_t IRAM_ATTR _lseek_r(struct _reent* unused, int file, _off_t ptr, int dir)
{
(void)unused;
(void)file;
(void)ptr;
(void)dir;
return 0;
}

int IRAM_ATTR _read_r(struct _reent* unused, int file, char *ptr, int len) {
_ssize_t IRAM_ATTR _read_r(struct _reent* unused, int file, void* ptr, size_t len)
{
(void)unused;
(void)file;
(void)ptr;
(void)len;
return 0;
}

int IRAM_ATTR _write_r(struct _reent* r, int file, char *ptr, int len) {
(void) r;
int pos = len;
if (file == STDOUT_FILENO) {
while(pos--) {
_ssize_t IRAM_ATTR _write_r(struct _reent* unused, int file, const void* vptr, size_t len)
{
(void)unused;
int pos = len;
const char* ptr = reinterpret_cast<const char*>(vptr);
if (file == STDOUT_FILENO)
{
while (pos--)
{
ets_putc(*ptr);
++ptr;
}
}
return len;
}

int _putc_r(struct _reent* r, int c, FILE* file) __attribute__((weak));

int IRAM_ATTR _putc_r(struct _reent* r, int c, FILE* file) {
(void) r;
if (file->_file == STDOUT_FILENO) {
ets_putc(c);
return c;
int _putc_r(struct _reent* unused, int c, FILE* file) __attribute__((weak));
int IRAM_ATTR _putc_r(struct _reent* unused, int c, FILE* file)
{
(void)unused;
if (file->_file == STDOUT_FILENO)
{
ets_putc(c);
return c;
}
return EOF;
}

int IRAM_ATTR puts(const char * str) {
int IRAM_ATTR puts(const char* str)
{
char c;
while((c = *str) != 0) {
while ((c = *str) != 0)
{
ets_putc(c);
++str;
}
ets_putc('\n');
return true;
}

// macro in stdio.h, usually redirected to _putc_r
// in case its not, make sure to have a stub
#undef putchar
int IRAM_ATTR putchar(int c) {

int IRAM_ATTR putchar(int c)
{
ets_putc(c);
return c;
}

void _exit(int status) {
(void) status;
void _exit(int status)
{
(void)status;
abort();
}

int atexit(void (*func)()) __attribute__((weak));
int atexit(void (*func)()) {
(void) func;
int atexit(void (*func)())
{
(void)func;
return 0;
}

Expand Down
3 changes: 2 additions & 1 deletion cores/esp8266/pgmspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
// This file's contents have been moved to newlib. This file simply
// includes the newlib pgmspace file as well as some ets headers
// to preserve backwards compatibility
// current source: https://github.com/earlephilhower/newlib-xtensa/blob/xtensa-4_0_0-lock-arduino/newlib/libc/sys/xtensa/sys/pgmspace.h

#pragma once

#include <sys/pgmspace.h>

Expand Down
60 changes: 30 additions & 30 deletions package/package_esp8266com_index.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"toolsDependencies": [
{
"packager": "esp8266",
"version": "3.2.0-gcc10.3-c791b74",
"version": "3.2.0-gcc10.3-261114-v2",
"name": "xtensa-lx106-elf-gcc"
},
{
Expand Down Expand Up @@ -219,57 +219,57 @@
]
},
{
"version": "3.2.0-gcc10.3-c791b74",
"version": "3.2.0-gcc10.3-261114-v2",
"name": "xtensa-lx106-elf-gcc",
"systems": [
{
"host": "aarch64-linux-gnu",
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/3.2.0-gcc10.3/aarch64-linux-gnu.xtensa-lx106-elf-c791b74.230224.tar.gz",
"archiveFileName": "aarch64-linux-gnu.xtensa-lx106-elf-c791b74.230224.tar.gz",
"checksum": "SHA-256:c8833744f1419eed60a3b7bc0e06b72eb94e4ab2cb13daa1a011d5e5663ea04f",
"size": "72905094"
"url": "https://github.com/mcspr/esp-quick-toolchain/releases/download/3.2.0-gcc10.3-261114-v2/aarch64-linux-gnu.xtensa-lx106-elf-gcc10.3-eqt3.2.0-24c4a47.tar.gz",
"archiveFileName": "aarch64-linux-gnu.xtensa-lx106-elf-gcc10.3-eqt3.2.0-24c4a47.tar.gz",
"checksum": "SHA-256:a21222b4f71a4b9528d1ee54b8d2e31abd279917e23a5dbfef65a038b9893874",
"size": "73019460"
},
{
"host": "arm-linux-gnueabihf",
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/3.2.0-gcc10.3/arm-linux-gnueabihf.xtensa-lx106-elf-c791b74.230224.tar.gz",
"archiveFileName": "arm-linux-gnueabihf.xtensa-lx106-elf-c791b74.230224.tar.gz",
"checksum": "SHA-256:d378d91c63200d4007d1af9e0f4f622b60f5d1c67dd81e63e3c20ddfb14bc3d0",
"size": "68111989"
"url": "https://github.com/mcspr/esp-quick-toolchain/releases/download/3.2.0-gcc10.3-261114-v2/arm-linux-gnueabihf.xtensa-lx106-elf-gcc10.3-eqt3.2.0-24c4a47.tar.gz",
"archiveFileName": "arm-linux-gnueabihf.xtensa-lx106-elf-gcc10.3-eqt3.2.0-24c4a47.tar.gz",
"checksum": "SHA-256:913f8e5d884b8ea53a4705a9e06bce09c234e210f5ca61fb9b3912dde2992b63",
"size": "68206354"
},
{
"host": "i686-pc-linux-gnu",
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/3.2.0-gcc10.3/i686-linux-gnu.xtensa-lx106-elf-c791b74.230224.tar.gz",
"archiveFileName": "i686-linux-gnu.xtensa-lx106-elf-c791b74.230224.tar.gz",
"checksum": "SHA-256:26fc73e2047c6e1d563db5ba56318b0e099cec5824d17744aac6f9031f104802",
"size": "76912811"
"url": "https://github.com/mcspr/esp-quick-toolchain/releases/download/3.2.0-gcc10.3-261114-v2/i686-linux-gnu.xtensa-lx106-elf-gcc10.3-eqt3.2.0-24c4a47.tar.gz",
"archiveFileName": "i686-linux-gnu.xtensa-lx106-elf-gcc10.3-eqt3.2.0-24c4a47.tar.gz",
"checksum": "SHA-256:00395acfaa139879e087509ae01efd0c0ec5ae6da69a0531642ad8b8395c4cd6",
"size": "77009709"
},
{
"host": "i686-mingw32",
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/3.2.0-gcc10.3/i686-w64-mingw32.xtensa-lx106-elf-c791b74.230224.zip",
"archiveFileName": "i686-w64-mingw32.xtensa-lx106-elf-c791b74.230224.zip",
"checksum": "SHA-256:0b4199eff915f33498413c8a852038f6c50bb87adf22579920fa4972a2cc15f0",
"size": "73750173"
"url": "https://github.com/mcspr/esp-quick-toolchain/releases/download/3.2.0-gcc10.3-261114-v2/i686-w64-mingw32.xtensa-lx106-elf-gcc10.3-eqt3.2.0-24c4a47.zip",
"archiveFileName": "i686-w64-mingw32.xtensa-lx106-elf-gcc10.3-eqt3.2.0-24c4a47.zip",
"checksum": "SHA-256:5dc96afe95b9948c999c061e6c84bdb1577cd96d218fbf1a49d57c323cc48c73",
"size": "73509488"
},
{
"host": "x86_64-apple-darwin",
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/3.2.0-gcc10.3/x86_64-apple-darwin14.xtensa-lx106-elf-c791b74.230224.tar.gz",
"archiveFileName": "x86_64-apple-darwin14.xtensa-lx106-elf-c791b74.230224.tar.gz",
"checksum": "SHA-256:59c9890ac51cfdd687e072e310f86e3aa2da549a02fa4d1dcda7f9bc2dffb0fe",
"size": "77742495"
"url": "https://github.com/mcspr/esp-quick-toolchain/releases/download/3.2.0-gcc10.3-261114-v2/x86_64-apple-darwin14.xtensa-lx106-elf-gcc10.3-eqt3.2.0-24c4a47.tar.gz",
"archiveFileName": "x86_64-apple-darwin14.xtensa-lx106-elf-gcc10.3-eqt3.2.0-24c4a47.tar.gz",
"checksum": "SHA-256:111cc4e40d9ac60f8db92a3ea3cdd81f39b639663709776e138361389cabe3f8",
"size": "77844436"
},
{
"host": "x86_64-pc-linux-gnu",
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/3.2.0-gcc10.3/x86_64-linux-gnu.xtensa-lx106-elf-c791b74.230224.tar.gz",
"archiveFileName": "x86_64-linux-gnu.xtensa-lx106-elf-c791b74.230224.tar.gz",
"checksum": "SHA-256:8ddcb9935dfdc88f9742bc3319c6dc01eb17618a785bb3474f0e52f00adf49cc",
"size": "76312800"
"url": "https://github.com/mcspr/esp-quick-toolchain/releases/download/3.2.0-gcc10.3-261114-v2/x86_64-linux-gnu.xtensa-lx106-elf-gcc10.3-eqt3.2.0-24c4a47.tar.gz",
"archiveFileName": "x86_64-linux-gnu.xtensa-lx106-elf-gcc10.3-eqt3.2.0-24c4a47.tar.gz",
"checksum": "SHA-256:2c3dae9b80c4c8815c1e341492d5c32c679abe1e0269bc48ec89a02877d7aa63",
"size": "76407536"
},
{
"host": "x86_64-mingw32",
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/3.2.0-gcc10.3/x86_64-w64-mingw32.xtensa-lx106-elf-c791b74.230224.zip",
"archiveFileName": "x86_64-w64-mingw32.xtensa-lx106-elf-c791b74.230224.zip",
"checksum": "SHA-256:41f0198b25a99aeeb410d5b978453295a46e2d844a60d5a9d245590a095e4ce4",
"size": "76928412"
"url": "https://github.com/mcspr/esp-quick-toolchain/releases/download/3.2.0-gcc10.3-261114-v2/x86_64-w64-mingw32.xtensa-lx106-elf-gcc10.3-eqt3.2.0-24c4a47.zip",
"archiveFileName": "x86_64-w64-mingw32.xtensa-lx106-elf-gcc10.3-eqt3.2.0-24c4a47.zip",
"checksum": "SHA-256:9f2f30135d345accf4ca215f19090f2475beaf5089d596574aef7248fcaa6856",
"size": "76688353"
}
]
},
Expand Down
4 changes: 3 additions & 1 deletion tests/sanity_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ cflags=$"\
-g \
-free \
-fipa-pta \
-Werror=return-type \
-Wall \
-Wextra \
-Werror \
-Wpointer-arith \
-fno-inline-functions \
-mtext-section-literals \
Expand Down
Loading