Skip to content

Commit

Permalink
Update native SDK support for espressif platform // Issue #366, #546, #…
Browse files Browse the repository at this point in the history
  • Loading branch information
valeros committed Apr 7, 2016
1 parent 9b95d68 commit 530868a
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 78 deletions.
1 change: 1 addition & 0 deletions examples/espressif/esp8266-native/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
[env:esp01_8266]
platform = espressif
board = esp01
build_flags = -Wl,-T"eagle.app.v6.ld"
36 changes: 36 additions & 0 deletions examples/espressif/esp8266-native/src/blinky.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "ets_sys.h"
#include "osapi.h"
#include "gpio.h"
#include "os_type.h"

static const int pin = 1;
static volatile os_timer_t some_timer;

void some_timerfunc(void *arg)
{
//Do blinky stuff
if (GPIO_REG_READ(GPIO_OUT_ADDRESS) & (1 << pin))
{
// set gpio low
gpio_output_set(0, (1 << pin), 0, 0);
}
else
{
// set gpio high
gpio_output_set((1 << pin), 0, 0, 0);
}
}

void ICACHE_FLASH_ATTR user_init()
{
// init gpio sussytem
gpio_init();

// configure UART TXD to be GPIO1, set as output
PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_GPIO1);
gpio_output_set(0, 0, (1 << pin), 0);

// setup timer (500ms, repeating)
os_timer_setfn(&some_timer, (os_timer_func_t *)some_timerfunc, NULL);
os_timer_arm(&some_timer, 1000, 1);
}
68 changes: 0 additions & 68 deletions examples/espressif/esp8266-native/src/user_main.c

This file was deleted.

29 changes: 19 additions & 10 deletions platformio/builder/scripts/espressif.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,16 +254,21 @@ def _fetch_spiffs_size(target, source, env):
join("$PIOPACKAGES_DIR", "sdk-esp8266", "include"),
"$PROJECTSRC_DIR"
],
LIBPATH=[join("$PIOPACKAGES_DIR", "sdk-esp8266", "lib")],

LIBPATH=[
join("$PIOPACKAGES_DIR", "sdk-esp8266", "lib"),
join("$PIOPACKAGES_DIR", "sdk-esp8266", "ld")
],

BUILDERS=dict(
ElfToBin=Builder(
action=" ".join([
'"$OBJCOPY"',
"-eo", "$SOURCES",
"-bo", "${TARGETS[0]}",
"-bm", "qio",
"-bf", "40",
"-bz", "512K",
"-bm", "$BOARD_FLASH_MODE",
"-bf", "${__get_board_f_flash(__env__)}",
"-bz", "${__get_flash_size(__env__)}",
"-bs", ".text",
"-bs", ".data",
"-bs", ".rodata",
Expand All @@ -277,20 +282,24 @@ def _fetch_spiffs_size(target, source, env):
)
)
env.Replace(
LDSCRIPT_PATH=join(
"$PIOPACKAGES_DIR", "sdk-esp8266", "ld", "eagle.app.v6.ld"),
LIBS=["c", "gcc", "phy", "pp", "net80211", "lwip", "wpa", "main",
"json", "upgrade", "smartconfig", "pwm", "at", "ssl"],
LIBS=[
"c", "gcc", "phy", "pp", "net80211", "lwip", "wpa", "wpa2",
"main", "wps", "crypto", "json", "ssl", "pwm", "upgrade",
"smartconfig", "airkiss", "at"
],

UPLOADERFLAGS=[
"-vv",
"-cd", "ck",
"-cd", "$UPLOAD_RESETMETHOD",
"-cb", "$UPLOAD_SPEED",
"-cp", "$UPLOAD_PORT",
"-ca", "0x00000",
"-cf", "${SOURCES[0]}",
"-ca", "0x40000",
"-cf", "${SOURCES[1]}"
]
],

UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS',
)

#
Expand Down

0 comments on commit 530868a

Please sign in to comment.