-
-
@Gordon: Take your time. Espruino is great, but having a son is so much more :-)
-
I've made a PR to discuss my code: https://github.com/espruino/Espruino/pull/1255
The large lib is not a problem of code size on the due. It's ~250 MBs of Code in the Espruino Repo.
-
-
-
We now have access to all pins (I counted 63 Pins - impressive) and the SystemTimer for setInterval() and setTimeout() is working - kind of. Not very accuracte. I'm on it.
If someone wants to have a go, here are the Bin-Files: https://www.thomaschristlieb.de/wp-content/uploads/2017/09/espruinoduebin.tar.gz
I think after getting a real accurate Time (better than one Second!) I'm trying to get save() to Work...
-
I've got a REPL, I've got Pin Functions (Config, Get, Set) for the first Pin (the onboard LED). I think we can call it Alpha Status :-)
Next would be to get the setTimeout running by implementing jshGetSystemTime with the build-in RTC. Then I need to enter all possible pins (all 54!) and make the Pin Functions for them.
Thats a lot of work, but not very complicated anymore.
-
-
-
We have a blinking LED!
That was really hard work for me, but I've added a working makefile and a working toolchain to Espruino. Now comes the part where we really code something!
@Gordon: Can you tell me which Functions I need to implement into jshardware.c to get a REPL going? -
If anyone wants to follow my silly attempts to get the Arduino Due to fly, here you go: https://github.com/ThomasChr/Espruino/tree/duedev
Brach: duedev
-
-
Okay, I don't fear the hard work, so heres my plan.
- I create a file 'board/ARDUINODUE.py' and insert all Arduino Due Data.
- I create a file (referenced in 1.) 'boards/pins/arduinodue.csv' and insert a few Pins. The LED, the first UART and maybe some minor more for the start.
- I copy my complete toolchain (without gcc of course) to '/targetlibs/samd'.
- I create 'targets/samd/main.c' which is a 1on1 copy from the correspondending EFM32 Port File, nothing hardware dependent in here.
- I create 'targets/samd/jshardware.js' (copy the file from the EFM32 Port!) and modify all of it so that it does compile on an Arduino Due.
- I need to change the build process so that my build commandos are jused. I'm not quite sure how to do that.
- I try to make Espruino with BOARD=ARDUINODUE and hope for the best.
Is this the right way to go? The one thing which is hard work seems to be 'jshardware.js' because to me it looks that this is the hardware dependent interface. Am I correct?
Thomas
PS: Yes, a long way to go.. :-)
PPS: @Gordon: How do I get the Patreon Batch in the Forums? - I create a file 'board/ARDUINODUE.py' and insert all Arduino Due Data.
-
Simply blinking a LED on the Due.
I see that the forum has a problem with the first line, it should read:#include "../include/due_sam3x.init.h"
You can transfer the file firmware.bin with the included program (under tools) 'bossac':
./bossac -p ttyACM0 -e -w -v -b /home/tc/firmware.bin
-
Okay, I've managed to gather all the required files for a build from the Arduino IDE and put them here: https://tclinux.de/due.tar.gz
Thats 100 MB :-(
-> Including the GCC Toolchain, which can be omitted.A simple Testprogram looks like that:
[#include](https://forum.espruino.com/search/?q=%23include) "../include/due_sam3x.init.h" /** * Simply blink the amber LED on the DUE with 2Hz: */ int main(void) { /* The general init (clock, libc, watchdog ...) */ init_controller(); /* Board pin 13 == PB27 */ PIO_Configure(PIOB, PIO_OUTPUT_1, PIO_PB27, PIO_DEFAULT); /* Main loop */ while(1) { Sleep(250); if(PIOB->PIO_ODSR & PIO_PB27) { /* Set clear register */ PIOB->PIO_CODR = PIO_PB27; } else { /* Set set register */ PIOB->PIO_SODR = PIO_PB27; } } return 0; }
You can compile it with:
../tools/g++_arm_none_eabi/bin/arm-none-eabi-gcc -c -Wall --param max-inline-insns-single=500 -mcpu=cortex-m3 -mthumb -mlong-calls -ffunction-sections -fdata-sections -nostdlib -std=c99 -Os -I../include -I../sam -I../sam/libsam -I../sam/CMSIS/CMSIS/Include -I../sam/CMSIS/Device/ATMEL main.c -o main.o ../tools/g++_arm_none_eabi/bin/arm-none-eabi-ar rcs firmware.a main.o ../tools/g++_arm_none_eabi/bin/arm-none-eabi-nm firmware.a > firmware.a.txt ../tools/g++_arm_none_eabi/bin/arm-none-eabi-g++ -Os -Wl,--gc-sections -mcpu=cortex-m3 "-T../sam/linker_scripts/gcc/flash.ld" "-Wl,-Map,./firmware.map" -o firmware.elf "-L" -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group firmware.a ../lib/libsam_sam3x8e_gcc_rel.a -Wl,--end-group ../tools/g++_arm_none_eabi/bin/arm-none-eabi-objcopy -O binary firmware.elf firmware.bin
So step 4 is done. Now I'm trying to modify Espruino to compile for the Arduino Due. If anyone wants to help, feel free to do so.
This might take some time!Thomas
Credits: Arduino IDE
Tutorial from: http://www.atwillys.de/content/cc/using-custom-ide-and-system-library-on-arduino-due-sam3x8e/?lang=en
-> But the Tutorial is outdated and has some errors. I needed to correct them. -
-
When I type 'make clean' all *.o-Files are deleted. That also deletes all *.o-Files in all Subdirectorys from the Espruino Code, including (in my Case) the Cross-Compiler which I downloaded in the root Directory of the source.
Make clean does the following:
$(Q)find . -name *.o | grep -v arm-bcm2708 | xargs rm -f
I propose that we change that to:
$(Q)find . -name *.o | grep -v arm-bcm2708 | grep -v gcc-arm-none-eabi-6-2017-q1-update | xargs rm -f
If you don't do that alle *.o Files from the cross compiler are deleted, including (for example) crti.o which is leading to a linker error on compile, because the Linker needs that object file.
Is my method to just download the cross compiler into the source root directory that odd that no one has ever had a problem with that?
I can make an Issue and PR in the Repo If wanted.
Greetings,
Thomas
PS: Problem with my simple fix is -of course- that we need to change the folder name 'gcc-arm-none-eabi-6-2017-q1-update' in the file 'scripts/provision.sh' and 'Makefile' everytime we change it. It's not nice to have that at two places to maintain I suppose.
-
Hi Gordon,
thanks for the hint. I think I'll give it a try.
My plan is:- Compile the Espruino Source on Linux 64 Bit.
- Compile the Espruino Source for a Pico Board and get it to run. (I have a few Espruino Picos and Wifis at hand).
- Flash the already ported (from some other guy) micropython on the Arduino Due and get that to run.
- Build an Arduino Due Blink-Prog from Scratch (on the Command Line with arm-gcc) and let that run on the Due.
- Modify the Espruino Source for the Due and let it run on the Due. I think the first "point of attack" would be modifying the Boards-File according to the Due Specs. I think the next big step is to change from the stm lib to the sam lib...
I've already done 1-3, so I'm moving forward now.
If you would like to give me any tipps, or want me to post a tutorial afterwards, just tell me.
Thomas
PS: Became a patreon member today. I think your work is amazing. And keeping such a close (and friendly!!!) look on the forums is also amazing. Even when you consider that the guys porting espruino to other devices kind of stealing your money because you sell less from your own boards...
PPS: I also have Making Things Smart on my kindle. Easy read with some new ideas! Good work!
- Compile the Espruino Source on Linux 64 Bit.
-
-
The Arduino Due Board has a Cortex M3 Processor and more flash and Ram than the original Espruino Board. You can get a clone for around 20$, original about 40$.
It should not be that hard to port Espruino, has anyone tried it yet?
Anyone interested?Here are the specs, it has some nice stuff built in like CAN: https://store.arduino.cc/usa/arduino-due
Thomas
Hello Forum,
this little test may neither be fair nor exact but i still wonder about the outcome...
The Leibniz Formula is a little float Problem for calculating Pi.
I wrote the code in Python and Javascript and let it run on the PyBoard and the Espruino Pico.
Here‘s the Python-Code:
And here‘s the „same“ in Javascript:
On the PyBoard the code took 26 seconds to execute, the Pico took 458 seconds.
I‘m a little puzzled of the outcome because I though both boards have floating point hardware, or am I wrong?
Can anyone explain the massive speed difference to me?
Thomas
PS: I know that this synthetic benchmark has nothing to do with overall speed, I just want to understand why these numbers are what they are in this particular case.