Enable dynamic build dates, plus print SDK version.

This commit is contained in:
Johny Mattsson 2015-10-07 13:33:09 +11:00
parent 439f72c43a
commit 21c4e11020
3 changed files with 17 additions and 8 deletions

View File

@ -3,15 +3,16 @@ before_install:
- sudo apt-get install -y python-serial srecord
install:
- tar -zxvf tools/esp-open-sdk.tar.gz
- export PATH=$PATH:$PWD/esp-open-sdk/sdk:$PWD/esp-open-sdk/xtensa-lx106-elf/bin
- export PATH=$PATH:$PWD/esp-open-sdk/xtensa-lx106-elf/bin
script:
- make all
- export BUILD_DATE=$(date +%Y%m%d)
- make EXTRA_CCFLAGS="-DBUILD_DATE='\"'$BUILD_DATE'\"'" all
- cd bin/
- file_name_float="nodemcu_float_${TRAVIS_TAG}.bin"
- srec_cat -output ${file_name_float} -binary 0x00000.bin -binary -fill 0xff 0x00000 0x10000 0x10000.bin -binary -offset 0x10000
- cd ../
- make clean
- make EXTRA_CCFLAGS="-DLUA_NUMBER_INTEGRAL"
- make EXTRA_CCFLAGS="-DLUA_NUMBER_INTEGRAL -DBUILD_DATE='\"'$BUILD_DATE'\"'"
- cd bin/
- file_name_integer="nodemcu_integer_${TRAVIS_TAG}.bin"
- srec_cat -output ${file_name_integer} -binary 0x00000.bin -binary -fill 0xff 0x00000 0x10000 0x10000.bin -binary -offset 0x10000

View File

@ -7,6 +7,10 @@
#define NODE_VERSION_INTERNAL 0U
#define NODE_VERSION "NodeMCU 1.4.0"
#define BUILD_DATE "build 20151006"
#ifndef BUILD_DATE
#define BUILD_DATE "20151006"
#endif
extern char SDK_VERSION[];
#endif /* __USER_VERSION_H__ */

View File

@ -135,9 +135,13 @@ static int docall (lua_State *L, int narg, int clear) {
}
static void print_version (void) {
// l_message(NULL, LUA_RELEASE " " LUA_COPYRIGHT);
l_message(NULL, "\n" NODE_VERSION " " BUILD_DATE " powered by " LUA_RELEASE);
static void print_version (lua_State *L) {
lua_pushliteral (L, "\n" NODE_VERSION " build " BUILD_DATE " powered by " LUA_RELEASE " on SDK ");
lua_pushstring (L, SDK_VERSION);
lua_concat (L, 2);
const char *msg = lua_tostring (L, -1);
l_message (NULL, msg);
lua_pop (L, 1);
}
@ -399,7 +403,7 @@ static int pmain (lua_State *L) {
lua_gc(L, LUA_GCSTOP, 0); /* stop collector during initialization */
luaL_openlibs(L); /* open libraries */
lua_gc(L, LUA_GCRESTART, 0);
print_version();
print_version(L);
s->status = handle_luainit(L);
#if 0
if (s->status != 0) return 0;