-
Notifications
You must be signed in to change notification settings - Fork 2.1k
pkg: Initial introduction of ubasic package #11319
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
Conversation
This sounds very useful for quick tests. Is there a way to extend this with additional commands to control periph functionality? Something like |
As far as I can see there is no "official way" to extend the library with functionality in such a way, but the code is very straight forward. Maybe we can provide such a feature upstream. |
Package compiles to around 2.3K on a samr21-xpro, so definitely smaller than the LUA and Javascript interpreters |
I believe this might be interesting for @kaspar030 then too. |
A benchmark of this on the samr21 against BASIC running natively on a ZX spectrum would be good. I guess there would be some metrics for the second around somewhere. |
I will look into this next week! |
tests/pkg_ubasic/tests.c
Outdated
end_t = clock(); | ||
delta_t = (double)(end_t - start_t) / CLOCKS_PER_SEC; | ||
|
||
printf("done. Run time: %.3f s\n", delta_t); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't print with newlib
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honest question: how do we deal with this? This C-file was imported from the package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My preferred solution (but this did not work at least with the 10 min I was willing to spend on this joke project) was to just copy tests.c
from the package BTW, since the package is pulled in after the application directory is compiled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With some brainstorming with @cladmi I think I came to a good way to do this, I think (this does not fix the bug upstream, I know)
tests/pkg_ubasic/Makefile
Outdated
|
||
include $(RIOTBASE)/Makefile.include | ||
|
||
clean: ..rm-main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remainders of my try not having include the foreign tests.c...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I removed that part in a fixup)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(and readded it after #11319 (comment))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd prefer an empty main.c, or as empty as gcc permits.
Fiddling with files within the source tree is usually a bad idea. E.g., CI builds multiple boards in the same checkout.
I suggest including tests.c in the pkg makefile depending on a make variable. "main()" doesn't have to be in the application folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, @cladmi had also the idea of introducing a pseudo-module (e.g. ubasic_tests
) for that, as it is the more RIOT-y way to go with that (and wouldn't introduce YAER (Yet Another Exception from the Rule). I did not like that idea, as it would be too messy (aka require my to modify pseudomodules.mk
as well). If we can live with that, I can do it that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found a way to do it without any pseudomodules or file fiddling.
Oh, April Fools btw if it wasn't clear ;-). But as with RFCs I wouldn't be mad if this got merged :P |
TBH I don't have the hardware for this :P |
Also your British-ness is leaking through ;-P. The rest of the world was happy with a Commodore 64 ;-D |
I've adopted the test for real hardware (I tested at least on a Cortex-M0) and the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested, works.
@jcarrano should I squash? |
Squashed (@jcarrano said yes offline) |
tests/pkg_ubasic/tests/01-run.py
Outdated
|
||
|
||
def testfunc(child): | ||
for i in range(1,6): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The static checks are whining about a missing space.
for i in range(1,6): | |
for i in range(1, 6): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed and squashed
Fixed some of the issues pointed out by Murdock. It will probably complain for a few boards about insufficient memory in the next run. |
Murdock's happy now, so I squashed. Feel free to hit merge @jcarrano :-) |
Contribution description
As we all know supporting more programming language is important and BASIC is an important programming language. So here is a port for it.
Testing procedure
Run
make -C tests/pkg_ubasic all test
on a board of your liking. The tests were provided by the package itself.
Issues/PRs references
None