Revive target: ESP8266
This patch updates ESP8266 build system and code base as well.
- Removed unnecessary files.
- Decreased code size.
- Refactored jerry_{port, extapi, run}.c to make it more easy to handle.
- Readme.md is updated as well which contains detailed step by step description about how to set up environment and use JerryScript.
Finally, it solves the related issue #1375.
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
@@ -13,12 +13,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "esp_common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "jerry-core/include/jerryscript-port.h"
|
||||
int ets_putc (int);
|
||||
#include "esp_common.h"
|
||||
|
||||
#include "jerryscript-port.h"
|
||||
|
||||
/**
|
||||
* Provide log message implementation for the engine.
|
||||
@@ -32,50 +34,49 @@ jerry_port_log (jerry_log_level_t level, /**< log level */
|
||||
|
||||
va_list args;
|
||||
va_start (args, format);
|
||||
/* TODO, uncomment when vprint link is ok */
|
||||
/* vprintf (stderr, format, args); */
|
||||
vfprintf (stderr, format, args);
|
||||
va_end (args);
|
||||
} /* jerry_port_log */
|
||||
|
||||
|
||||
/** exit - cause normal process termination */
|
||||
void exit (int status)
|
||||
/**
|
||||
* Provide fatal message implementation for the engine.
|
||||
*/
|
||||
void
|
||||
jerry_port_fatal (jerry_fatal_code_t code)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
}
|
||||
} /* exit */
|
||||
|
||||
/** abort - cause abnormal process termination */
|
||||
void abort (void)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
}
|
||||
} /* abort */
|
||||
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Jerry Fatal Error!\n");
|
||||
while (true);
|
||||
} /* jerry_port_fatal */
|
||||
|
||||
/**
|
||||
* fwrite
|
||||
* Implementation of jerry_port_get_current_time.
|
||||
*
|
||||
* @return number of bytes written
|
||||
* @return current timer's counter value in milliseconds
|
||||
*/
|
||||
size_t
|
||||
fwrite (const void *ptr, /**< data to write */
|
||||
size_t size, /**< size of elements to write */
|
||||
size_t nmemb, /**< number of elements */
|
||||
FILE *stream) /**< stream pointer */
|
||||
double
|
||||
jerry_port_get_current_time (void)
|
||||
{
|
||||
return size * nmemb;
|
||||
} /* fwrite */
|
||||
struct timeval tv;
|
||||
|
||||
if (gettimeofday (&tv, NULL) != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ((double) tv.tv_sec) * 1000.0 + ((double) tv.tv_usec) / 1000.0;
|
||||
} /* jerry_port_get_current_time */
|
||||
|
||||
/**
|
||||
* This function can get the time as well as a timezone.
|
||||
* Dummy function to get the time zone.
|
||||
*
|
||||
* @return 0 if success, -1 otherwise
|
||||
* @return true
|
||||
*/
|
||||
int
|
||||
gettimeofday (void *tp, /**< struct timeval */
|
||||
void *tzp) /**< struct timezone */
|
||||
bool
|
||||
jerry_port_get_time_zone (jerry_time_zone_t *tz_p)
|
||||
{
|
||||
return -1;
|
||||
} /* gettimeofday */
|
||||
/* We live in UTC. */
|
||||
tz_p->offset = 0;
|
||||
tz_p->daylight_saving_time = 0;
|
||||
|
||||
return true;
|
||||
} /* jerry_port_get_time_zone */
|
||||
|
||||
Reference in New Issue
Block a user