Skip to content

Instantly share code, notes, and snippets.

@fanoush
Created May 12, 2020 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fanoush/fa340b43aa2bf5e3881fa7a7f6e6f14b to your computer and use it in GitHub Desktop.
Save fanoush/fa340b43aa2bf5e3881fa7a7f6e6f14b to your computer and use it in GitHub Desktop.
patch to https://github.com/gfwilliams/EspruinoCompiler to run locally for nrf52832
diff --git a/compile.js b/compile.js
index d380ac6..a4f76e2 100644
--- a/compile.js
+++ b/compile.js
@@ -437,13 +437,14 @@ function gcc(code, callback) {
- var cflags = "-mlittle-endian -mthumb -mcpu=cortex-m3 -mfix-cortex-m3-ldrd -mthumb-interwork -mfloat-abi=soft ";
+// var cflags = "-mlittle-endian -mthumb -mcpu=cortex-m3 -mfix-cortex-m3-ldrd -mthumb-interwork -mfloat-abi=soft ";
+ var cflags = "-mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -fsingle-precision-constant -Wdouble-promotion -Wfloat-conversion ";
cflags += "-nostdinc -nostdlib ";
cflags += "-fno-common -fno-exceptions -fdata-sections -ffunction-sections ";
cflags += "-flto -fno-fat-lto-objects -Wl,--allow-multiple-definition ";
cflags += "-fpic -fpie ";
cflags += "-fpermissive "; // for (int i=0;...);return i;
- cflags += "-fpreprocessed "; // disable preprocessing
+// cflags += "-fpreprocessed "; // disable preprocessing
cflags += "-Os ";
cflags += "-Tinc/linker.ld ";
diff --git a/server.js b/server.js
index 82c2895..e135b94 100644
--- a/server.js
+++ b/server.js
@@ -30,6 +30,8 @@ function respondWithCompilerMessage(response, message) {
}
function handlePost(post, response) {
+
+response.setHeader("Access-Control-Allow-Origin", "*");
console.log("POST ",post);
var SUPPORTED_BOARDS = [
@@ -37,9 +39,9 @@ function handlePost(post, response) {
"PUCKJS","PIXLJS","MDBT42Q","WIO_LTE","THINGY52","NRF52832DK",
"STM32L496GDISCOVERY","RAK8211","RAK8212","RUUVITAG"
];
- if (post.board && SUPPORTED_BOARDS.indexOf(post.board)==-1) {
- respondWithCompilerMessage(response, "Only offical Espruino boards are supported by the Compiler Service");
- }
+// if (post.board && SUPPORTED_BOARDS.indexOf(post.board)==-1) {
+// respondWithCompilerMessage(response, "Only offical Espruino boards are supported by the Compiler Service");
+// }
var exports;
if (post.exptr) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment