-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
CC3K: Not working since merge #885
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
Comments
I want to mention that I found the import cc3k CC3k (why the small k, extremely confusing) which isn't mentioned anywhere except in a previous issue. Could you please add this kind of documentation so that people who aren't that acquainted with github still know what changed / and hopefully what they are doing :) ( a PIN out for the CC3K would be nice I suppose). |
The internet modules (cc3k and wiznet) are still work in progress, pending a decision in #876. Their initialisation will be easier and documented, and binaries will be available with these driver compiled in. Re naming: all classes are named using camel case, but acronyms make this a bit tricky sometimes. The class would have been CC3000, but it's also supposed to support CC3100 (eventually). CC3k was chosen since it encompases both. Think of 3000 as a word, which in camel case has the 3 upper and the 000 lower, hence it becomes 3k :) I also don't like typing it, but I have no better ideas that keep consistency. We can make it CC3K if people prefer. |
Okay, then I suppose we're just going to wait on continuing our IoT project with the Micro Python board. That's probably going to save us from a lot of hassle :P Thanks for the quick reply and happy coding. |
Keeping this issue open because it is a real issue that needs to be solved. |
Alright, if anything changes I'll know, receiving updates from this repository from now on ;) |
CC3000 and WIZ820io support are now "working" on master branch, and firmware binaries will be available each night at micropython.org/download. There is a separate firmware with network drivers included. Quick example:
That sets up the network. You need to have the CC3000 connected on pins X3 through X8: X3=IRQ, X4=EN, X5=CS, X6=SCK, X7=MISO, X8=MOSI. Wait for an IP address (call cc3k.is_connected()) then use socket as you normally would:
|
So, is it "socket" or "usocket" after all? |
Haha, a loaded question :) It's actually available as both socket and usocket. I have an idea that I was testing and wanted to discuss: prefix all uPy builtin modules with u (uos, usys, utime, ...) and then provied a weak reference to them with the corresponding non-u name (nothing to do with CPython weakref modul, but rather link-editor-style weakref). The weak reference can be overridden by providing your own version of the module (as a file), if wanted. Without overridding, eg, import os will resolve to uos and then uos is a decent enough substitution (a micro substitution) for a full os module. This way: 1) we are free to provide micro implementations of all modules, unencumbered by any CPython bloat, but with the broad aim that the u-module can be used in place of the non-u-module in >90% of cases; 2) users don't need to change their habits or code and can just use, eg, The main issue with this is efficiency. At the moment, all builtin modules (eg sys) are returned straight away from the import machinery, without searching the filesystem. To implement weakref imports, one needs first to search the filesystem for any overrides, and only if not found is the weakref followed. |
Thanks for fixing and closing the issue. Looks like a straightforward way to do this so good job on that! |
@thomasvnl : let me know how it goes for you. There are probably a few bugs and things to tidy up in the interface, but otherwise it should work ok (as well as the CC3k hardware will allow!). |
Will do |
Great idea :)
I think it's better to do that only if the module is complete and compatible with CPython, otherwise people are gonna keep expecting functionality that just isn't there. |
It's actually available as both socket and usocket. I see, so currently for stmhal you have:
Well, I'm in favor of this, to let them be overriden by (more) complete Python implementation, I even proposed to rename stmhal's os to _os.
Yeah, but how to implement that? For it to work automagically, as you say, it would first need to scan filesystem. As you say, it's drop in efficiency. It's also unclear how exactly to implement it - in some adhoc, hardcoded way? That will at least cost us minimum amount of bytes, but adhoc stuff in import code won't be too beautiful. More generic solution is to add some kind of "import hooks" or whatever CPython has, but that will cost even more bytes (and I kinda start to worry that with all such additions we'll stop being "micro" soon). So, I don't know, let me be skeptical on this one ;-). I think we can at least start with having non-complete builtin modules be named differently, but not worry that people will need to use these different names if they want highest efficiency. Of course, this outlook is based on "unix" port needs, not on "stmhal" one, so I understand if you don't agree. |
Or uos? _os should be reserved for a full CPython _os module :) For us, we should use _uos if we implement a cut down uos to be augmented by a uos.py script. But already the philisophy is to have uos a micro version of os, that is usable without any wrapper.
Yes, but then users can
It can be an option in the core: if enabled, just need 1 other dict of weak refs (mp_builtin_weak_module_dict_obj, that is provided by a given port) which is scanned only if a search of the filesystem fails.
Right, and if they don't care about efficiency, weak ref is there to allow them to On pyboard, a scan of the internal filesystem is pretty cheap (since fs is in ROM). By having the weak ref as a port option, we can use it only in stmhal, and have unix use scripts (eg os.py) in a library directory to provide non-u modules. The weak ref thing is really not that ad-hoc if you think of it this way: there is a (hidden) path in the import search path that is very last, and it is simply a (fake) directory of (virtual) wrapper scripts like os.py than do |
I guess then it's worth to discuss policy for "" vs "u" prefix too. "" policy is essentially laid out in CPython - if a module is not intended for direct user use, it has "" prefix. So, all "" modules are internal and it's implementation-dependent which are available, and what's inside. CPython3 for example doesn't have _os. uPy has _collections, which implements just a particular collection class (the rest are intended to be implemented in Python). Unix port has _os, which has just a single function. On the other hand, "u" modules are intended for direct use, and thus all stmhal modules indeed should have "u" prefix. |
Agreed with all points made in above comment. Then it's up to the port to follow this policy ( |
rev E feather M4 express; remove named AREF pins
Since the master branch got merged with the the iabdalkader-cc3k-update CC3K is no longer working the way it did before. I have enabled CC3K in mpconfigport.mk but that didn't do much good. I tried replacing MICROPY_HW_ENABLE_CC3K with MICROPY_PY_CC3K in stmhal/pybwlan.c but that too failed the moment it tried to import the first item of the required headers in stmhal/pybwlan.c. Anyone have any thougts on this?
The text was updated successfully, but these errors were encountered: