mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
target: mbedos5: Update to mbed OS 5.4.5 (#1853)
Also ignore the default jerry-port - see also #1847. Re-implement the `print()` function, as it's no longer part of core Jerry, but our programs still depend on it. JerryScript-DCO-1.0-Signed-off-by: Jan Jongboom janjongboom@gmail.com
This commit is contained in:
parent
a8a25e7f3c
commit
37ed82437b
@ -19,9 +19,9 @@
|
||||
BOARD=$(subst [mbed] ,,$(shell mbed target))
|
||||
HEAPSIZE=16
|
||||
|
||||
DEBUG=0
|
||||
NO_JS=0
|
||||
MBED_VERBOSE=0
|
||||
DEBUG?=0
|
||||
NO_JS?=0
|
||||
MBED_VERBOSE?=0
|
||||
|
||||
MBED_CLI_FLAGS=-j0 --source . --source ../../
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
#include "jerryscript-mbed-drivers/DigitalOut-js.h"
|
||||
#include "jerryscript-mbed-drivers/setInterval-js.h"
|
||||
#include "jerryscript-mbed-drivers/setTimeout-js.h"
|
||||
#include "jerryscript-mbed-drivers/print-js.h"
|
||||
#include "jerryscript-mbed-drivers/assert-js.h"
|
||||
#include "jerryscript-mbed-drivers/I2C-js.h"
|
||||
#include "jerryscript-mbed-drivers/gc-js.h"
|
||||
@ -32,6 +33,7 @@ DECLARE_JS_WRAPPER_REGISTRATION (base) {
|
||||
REGISTER_GLOBAL_FUNCTION(setTimeout);
|
||||
REGISTER_GLOBAL_FUNCTION(clearInterval);
|
||||
REGISTER_GLOBAL_FUNCTION(clearTimeout);
|
||||
REGISTER_GLOBAL_FUNCTION(print);
|
||||
REGISTER_CLASS_CONSTRUCTOR(DigitalOut);
|
||||
REGISTER_CLASS_CONSTRUCTOR(I2C);
|
||||
REGISTER_CLASS_CONSTRUCTOR(InterruptIn);
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
/* Copyright JS Foundation and other contributors, http://js.foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef _JERRYSCRIPT_MBED_DRIVERS_PRINT_H
|
||||
#define _JERRYSCRIPT_MBED_DRIVERS_PRINT_H
|
||||
|
||||
#include "jerryscript-mbed-library-registry/wrap_tools.h"
|
||||
|
||||
DECLARE_GLOBAL_FUNCTION(print);
|
||||
|
||||
#endif // _JERRYSCRIPT_MBED_DRIVERS_PRINT_H
|
||||
@ -0,0 +1,36 @@
|
||||
/* Copyright JS Foundation and other contributors, http://js.foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "mbed.h"
|
||||
#include "jerryscript-mbed-drivers/print-js.h"
|
||||
|
||||
/**
|
||||
* print (native JavaScript function)
|
||||
*
|
||||
* Print a string over serial (baud rate 115,200)
|
||||
*
|
||||
* @param string String to print
|
||||
*/
|
||||
DECLARE_GLOBAL_FUNCTION(print) {
|
||||
CHECK_ARGUMENT_COUNT(global, print, (args_count == 1));
|
||||
CHECK_ARGUMENT_TYPE_ALWAYS(global, print, 0, string);
|
||||
|
||||
jerry_size_t szArg0 = jerry_get_string_size(args[0]);
|
||||
jerry_char_t *sArg0 = (jerry_char_t*) calloc(szArg0 + 1, sizeof(jerry_char_t));
|
||||
jerry_string_to_char_buffer(args[0], sArg0, szArg0);
|
||||
|
||||
printf("%s\n", (const char*)sArg0);
|
||||
|
||||
return jerry_create_undefined();
|
||||
}
|
||||
@ -15,6 +15,8 @@
|
||||
#ifndef _JERRYSCRIPT_MBED_UTIL_LOGGING_H
|
||||
#define _JERRYSCRIPT_MBED_UTIL_LOGGING_H
|
||||
|
||||
#include "mbed.h"
|
||||
|
||||
#ifdef DEBUG_WRAPPER
|
||||
#define LOG_PRINT(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
|
||||
@ -1 +1 @@
|
||||
https://github.com/ARMmbed/mbed-os/#d5de476f74dd4de27012eb74ede078f6330dfc3f
|
||||
https://github.com/ARMmbed/mbed-os/#8d21974ba35e04c4854e5090c0f8283171664175
|
||||
|
||||
@ -9,3 +9,4 @@ targets/*
|
||||
tests/*
|
||||
third-party/*
|
||||
tools/*
|
||||
jerry-port/default/*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user