New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenWRT package compilation #143
Comments
Hi. I have managed to build and run Espruino on OpenWRT (on VoCore v1.0). I have prepared a quick-and-dirty feed package (it patches Makefile): Oh, this package only builds with uClibc.. didn't try to build with musl. |
That's awesome, thanks! sorry for not replying to you on YouTube - not sure what happened there. The package looks good - is there any chance the Makefile could be tweaked (maybe put About the The code for it is here - but I'm actually pretty surprised that it could be failing :( |
musl libc also works with minor changes! |
Funny.. getTime is negative :)
|
Ahh, well that'd do it! Maybe an overflow somewhere? It's this function |
As you may have read on twitter, we at DPTechnics started porting the Espruino runtime to our DPT-Board (OpenWRT, MIPS, AR9331). We don't have the getTime() bug, compiled from the latest code, so which codebase have you used? I must say we have now used the stlibcpp and not uclibc++, I'm going to try to use uclibc++ tomorrow and post back results. |
Actually I got getTime fixed by changing:
But it didn't help with the setInterval(). |
In the https://github.com/vshymanskyy/OpenWRT-Espruino-packages
|
I have traced this problem down to this:
Note, that jswrap_interface_setInterval gets a strange timeout value. |
OK, got it working...
I had to change jsnCallFunction to behave same way as on ARM platforms. |
Glad you got it working, I'm was testing your javascript snippet and got a Segmentation fault: >setInterval(function(){ console.log(getTime()) }, 1000)
Segmentation fault I'm now modifying the source to compile without warnings, because I get quite a lot of them. Mostly unused parameters and some casting errors. |
@daanpape thanks for posting up - any pull requests you have would be great (I reckon you could hard-code paths for your specific device in Also, your segfault is almost certainly the issue @vshymanskyy discovered with the calls. Did you want to do a pull request for that (and your other patches) @vshymanskyy ? IMO the call handling is actually specific to x86. It'd actually be better to have |
@daanpape the thing @vshymanskyy fixed is basically this: fc9b830 But with your processor in there. If someone did a PR changing that to non-x86 it'd be great. note: whether it works actually depends on how your specific processor handles function calls (which registers it puts arguments in). Luckily pretty much every device apart from x86 is really sensible and puts arguments on the stack (and maybe a few registers) so the code is usually the same for each. |
Ok, I just verified the getTime() being negative is a uClibc issue. When i link against the libstdcpp there are no problems. I'm working on a pull request using the OPENWRT define to make uClibc compilation possible. @gfwilliams I have now introduced ifdef X86 in jsNative to handle this. I'm preparing the pull request with the timefix from @vshymanskyy and the X86 preprocessor. It also introduces the makefile fixes to build for OpenWRT with uClibc/musl. building goes with OPENWRT=1 RELEASE=1 make. I don't have a segfault any more but the setInterval is going way to fast just like @vshymanskyy the getTime() function now works correctly. I'm still getting the wrong parameters passed:
>setInterval(function(){ console.log(getTime()) }, 1000)
=1
1443532932.48394298553
1443532932.48554396629
1443532932.48673295974
1443532932.48789501190
1443532932.48905611038
1443532932.49021601676
1443532932.49137997627
1443532932.49254107475 Thanks for all the help allready @gfwilliams and @vshymanskyy |
@daanpape , You just hijacked my fixes, LOL ;) |
@vshymanskyy yes, I wanted to test out your fixes, but I have not inserted them in my pull request because you earn the credits. But at even with your fixes I still have the problem on my platform AR9331. Still working out what the difference is. |
@gfwilliams , after fixing Espruino, I got Blynk JS library running on VoCore, as well as on Pico+ESP8266. |
I'm still having issues, and I can't work out how to interpret the stack. So as a test I'm calling the following in espruino cli:
Than I break in gdb on 'jsnCallFunction' this gives the following data:
So the timeout variable is argData[1,2,3] why 3x*32bit? |
I just found the problem. I used the commits from @vshymanskyy where the USE_X86_CDECL preprocessor was introduced. But this breaks the code for the MIPS in AR9331 in the file jsnative.c on line 53:
This increments the argCount which causes a misalignment on line 101:
On my AR9331 MIPS platform this extra increment of argCount is invalid. So it is not so easy as saying x86 vs all the rest as it turns out. @vshymanskyy @gfwilliams: I don't understand how this extra increment could ever work on any platform as it just leaves garbage data in the argData array. How should we fix this? |
Thanks for all the PRs! In wasn't around yesterday so wasn't able to help out unfortunately.
I think the point is that 64 bit values stay aligned to 64 bit word boundaries in memory. This commit makes me think I did it because it is required on ARM. So I think in this case it's probably going to require that there's an |
Hello, I have implemented the proposed fix in my fork: dptechnics@52f252a Before opening a pull request it may be handy if @vshymanskyy verifies this on his hardware as this is also MIPS. I find it quite confusing the code worked on the VoCore (RaLink) and not the DPT-Board (Qualcomm/Atheros). |
Yes, absolutely - I wonder why there's the difference. Could it be a GCC version issue? It only happens on some functions, but given one of them is
That's awesome - sorry, I missed that before - I had like a million e-mails yesterday. I'd noticed the node-compatibility in it when you'd got it running on the Pico - it's really neat. I'd really like to get this submitted to OpenWRT when we sort out the function call issue. I know now there's currently a build target specifically for dptechnics, but I wonder whether there's a way we can make the same build work for a variety of boards? |
@gfwilliams, @daanpape: It's updated to Espruino master, until you release version 81 with current changes. Regarding other boards - in the patch I add gpio to all linux boards (we could do it only for OpenWrt-basd..). It looks like the most generic approach. But what for the SPI/I2C support... About Blynk + JS, here is also an Instructable I finished writing today: http://www.instructables.com/id/Blynk-JavaScript-in-20-minutes-Raspberry-Pi-Edison/ |
@vshymanskyy the makefile looks very good, I have tested everything with uclibc (not the ulibc++ because it is not needed and takes up additional flash space) and it works like a charm. I think you can lower the dependencies in your makefile. I'm currently using the following openWRT makefile (off course when released the source must be downloaded from espruino git):
I'm working on SPI and I2C, I'l give some updates when I got it it work. @vshymanskyy is your test platform also MIPS, see the bug above. |
With SPI and I2C, I guess the issue is finding out which pins are connected to which SPI/I2C device path? While it could be hard-coded for your board it seems like the kind of thing that you should be able to query the OS for? |
@gfwilliams actually there are kernel modules for SPI and I²C and in OpenWRT one must configure these kernel modules to use the correct pins. I'm looking now to connect to these kernel modules which present devices in /dev which are agnosting from the pin-layout. So it should be quite straight forward. |
@daanpape, thank for you hints, I removed the unneeded dependencies. |
Hi - I just added some more hacks into Might be helpful? You might be able to see if something like the passing of doubles isn't working. |
Bump. |
Hi, thanks! How did testing go? Is it easier if you just contribute the Makefile changes as a pull request, then the patch won't need keeping up to date? Perhaps just as an 'OPENWRT' target? Did you want to submit the package yourself, or do you want me to do it? |
It works well when compiled with musl.
For me it's no issue (musl is default and I also use it), and I currently don't have time to investigate. Yes we can just include the changes in next release, then update the package not to apply any patches |
Which architecture were you going for? I know x86 (non-64) has some issues with GCC5 as I think they changed the calling convention. |
Hi @vshymanskyy |
@OwenBrotherwood , I'm quite busy currently, but hopefully I'll get a chance to play with the VoCore2 I got recently, so I will check if it works and update the instructions. |
@OwenBrotherwood Yes I can confirm my package works on VoCore 2 according to instructions on https://github.com/vshymanskyy/OpenWRT-Espruino-packages
@gfwilliams I also updated the version to 1.92. Could you please review and incorporate my patch if possible? https://github.com/vshymanskyy/OpenWRT-Espruino-packages/blob/master/espruino/espruino/patches/010-makefile-fix.patch |
Just done - thanks! |
https://github.com/vshymanskyy/OpenWRT-Espruino-packages |
That's fantastic - thanks for the update! |
Closing this - looks like there's not been any interest in the last 6 years. Shame really as it would have been pretty neat - but I guess it's not too hard to just build it natively for whatever Linux target you want. |
We need to create an OpenWRT package. The current package file looks as follows - however the compiler used by OpenWRT seems to dislike the 'gc-sections' flag, as well as having issues compiling against libc.
The text was updated successfully, but these errors were encountered: