gfwilliams / EspruinoCompiler

Node.js-based JavaScript->C++ compiler
25 stars 3 forks source link

how to config the process.env.EXPORTS #2

Closed haosu1987 closed 9 years ago

haosu1987 commented 9 years ago

When I sent code optimized the function with "compiled", It prompt "Compiler not active as no process.env.EXPORTS available". How to fix it ? The firmware version is 1v17.24, and The "EXPORTS" variable has no values.

gfwilliams commented 9 years ago

1v17.24? Are you sure? Most up to date firmwares should be somewhere around 1v79. If it is 1v17 that would be your problem - that's around 2 years old and won't have the code that's required.

Are you using the Web IDE from the Chrome Web Store? Try connecting to the board before uploading - The Web IDE has to have been connected once in order to request the data on the relevant functions.

haosu1987 commented 9 years ago

I'm using NUCLEO STM32F411RE. The firmware is not contained in official site. So I compiled it with the source code in github. The command is "NUCLEOF411RE=1 make". I'm sure the board has been connected to Web IDE before uploading. And I have run the js successfully with no "compiled" code.

gfwilliams commented 9 years ago

What happens if you execute process.env.EXPORTS when connected to the board? Does it list anything?

It might be that boards other than the 'official' ones don't report back the information needed to compile JS code for them.

haosu1987 commented 9 years ago

Thanks for your answer! I executed the process.env.EXPORTS in IDE command line, and the output json stream is as follows: image And when I was uploading the JS code some error messages popped out: image After the upload was done, the result was as follows: image And with a result return: image I'm not sure if the result is correct. Pls let me know if anything further info is needed. Many thanks in advance!

gfwilliams commented 9 years ago

Thanks for posting that up - it all looks good. What do you see when you go to settings and then scroll down to 'Board Information'?

I guess it could be possible that the IDE doesn't wait for long enough to receive all the information from the board at 9600 baud...

haosu1987 commented 9 years ago

Uh, message is as follows: Unable to get board information. Please connect to an Espruino board first.

Does it mean that there is something wrong with the Web IDE, and I can ignore this error?

gfwilliams commented 9 years ago

What it means it it wasn't able to get the information, like process.env.EXPORTS, when it connected to the board - probably because it took too long to send. You probably see some text in the console window each time you connect?

The fix is probably to change the baud rate for the binary you compile (add the line 'default_console_baudrate' : "115200", to boards/NUCLEOF411RE.py under the default_console line), then change the baud rate in the Web IDE.

Just to add, everything would work just fine if you just purchased one of the Espruino boards that we sell :)

haosu1987 commented 9 years ago

I think I have got it. Thanks for your excellent work.