a hobby class on microcontrollers

FWIW, Texas Instruments just came out with a simple MSP430 eval board that costs $4.30:

formatting link

I like MSP430 because is low power, pretty well supported and low cost, but still has non-vendor-specific toolchains (GCC, Rowley, etc).

This board looks good on features, but I haven't checked it out personally.

Reply to
Przemek Klosowski
Loading thread data ...

It says value line chips. I.e. 1K or 2K program space. I don't think you can do much with GCC in 2K.

Reply to
linnix

What makes you think that? If the people who did the backend port did a good job, gcc produces assembler that's as good as (sometimes better than) what you could do manually.

Reply to
DJ Delorie

The msp430 port of gcc is not updated as fast as other ports (it is not part of the mainline gcc), and in particular the click-to-install windows build is a bit old. But as long as it supports the device you are using, it is a solid compiler that produces reliable and efficient code.

The key to working with C with such small memories is the same regardless of the compiler - be careful of how you code, and avoid anything that brings in large pieces of library.

I used avr-gcc for a project on a Tiny 12 device with 1K flash and /no/ ram (only the 32 registers).

Reply to
David Brown

I can't speak much about gcc on the msp430. Never tried it. I don't expect the libraries to be very good, unless for some reason this is a very well-worn rut like the ARM7TDMI is. And I doubt it has had that much "stone soup" work on it, as yet.

But that misses the point I believe I'm moving towards. I don't think this isn't going to be about teaching c/c++ as much as being a fun environment for all. For new people, I doubt they will be able to, or want to, engage in c/c++ programming. Maybe later. Maybe a few who are advanced. Maybe.

I am faced with making this fun and easy to try out and, I hope, I will get some laughs and maybe even some questions that allow me to expand on a few points of interest for a short time. Some may even come back.

I am having a hard time imagining starting this out on a gcc footing.

That said, 1-2k is small. 512 to 1024 words -- and many instructions require more than one word, as the destination mode is woefully short on options to name one problem. I was (am) hoping that TI will come out with compatible DIP versions of others in its MSP430 line (not in the value line, but in more expensive parts) that will also fit the socket that comes on that cheap board system.

Either way, I plan on implementing a simple language where I can take into account criticisms and suggestions and tailor it to what I learn in the process. If I am careful and crafty, I may be able to make something usable that fits into a small space. For example, the entire non-swapped portion of the HP 2000F timesharing system (supporting 32 users) fit into 6k x 16 memory. Admittedly, that didn't include the IO support. But it included floating point with transcendentals and matrix math including inversion an determinants.

Assembly code and skill can do a lot with a little.

Whether that would mean 1024 words would be sufficient for a very simple system remains to be learned. In any case, this still fails to take into account that I want the students able to enter programs they write. And that requires space, as well. It's possible that it doesn't have to be much and it could be in the sram, too. But yes, I may find the limit of 1024 words too restrictive. Which is why I hope larger parts will be available that will fit that board (if I decide to go that way.)

I need to put work out the scope and details more before I have much more to add.

Jon

P.S. Got a full mailbox message from an email I sent you. And thanks very much for the quick and excellent service!

Reply to
Jon Kirwan

I think it's been mentioned. I had also ordered 9 of them a few weeks ago. 6 are backordered.

Jon

Reply to
Jon Kirwan

There are a number of reasons why that is both true and untrue. A lot depends on the application space, of course.

There are some advantages to assembly coding that c compilers cannot reach, as yet. For example, most c compilers I've experienced are not nearly as flexible as assembly in adapting caller/callee protocols -- there are some immutable aspects that a c compiler _must_ depend upon. Also, there are many semantics available in assembly that simply are not, in c. And besides, a human can perform unique on-the-fly topology transformations of algorithms that are well beyond c compiler technology I'm aware of and which themselves cannot be re-expressed back into some new c syntax. I think there has been a thread or two on that topic here, as well.

On the the other hand, a c compiler is a lot better than a human at some things, too. And these can make up a lot of ground. So don't get me wrong.

It just seems a little careless to write that a good backend is sufficient to produce something as good as (or better than) hand coding. That may be necessary, but it isn't always sufficient.

Jon

Reply to
Jon Kirwan

This triggered a a idea you may want to consider. Many years ago in a university setting I was teaching programming to engineering students and we were using the M6808. Early in the course I subsetted the instruction set to a fully functional but subset of the instruction set. For example all of the instructions dedicated to the first page of memory could be eliminated. There are lots that can be eliminated. Most memory to memory operations and in some cases addressing modes.

This resulted in a fully functional processor (less efficient code) This approach made understanding the instruction set much easier and reduced potential for instruction usage errors. I modified the assembler we used to accept only the subset instruction set and provided processor documentation for the subset instruction set.

Regards

walter..

-- Walter Banks Byte Craft Limited

formatting link

Reply to
Walter Banks

Yes, that could be done (and is done still) in first year college CS classes (last I checked, which was perhaps 3 years ago.) I'm not exactly trying to reach that crowd, but it does remind me -- a mix of low level with high level 'instructions', such as IN which might activate the keyboard and accept a line of input and convert the decimal-ASCII entry into a binary register value. Nothing like that _really_ exists, of course. But it focuses the teaching on ALU logic and arithmetic basics and sweeps away complicating I/O and peripheral type issues. Maybe that is part of what you meant, too.

Still, I'm mostly focused upon "action, lights, fire, smoke, explosions, and sparkly things" part of this to get attention and interest flowing. I want logic and maybe the need for arithmetic to sneak up on them and become an interest because it helps them blow something up or make fire or generate sparks or ... well, I want them to laugh and enjoy the time. If they actually _do_ become more interested in going further, _then_ I'll be there to help on that score. When they ask, not before, seems better to me.

Jon

Reply to
Jon Kirwan

What is a "non-vendor-specific toolchain" ?

--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills  Staffs  England     /\/\/\/\/
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Reply to
Chris H

Try the IAR compiler. IAR are "non-vendor specific" they do a free version of their compiler with 4 or 8 K code limit.

I also not that TI reference the IAR compiler in their notes so you can bet that it will have a load of examples for that chip/compiler combination.

So for $4.40 it looks like a no brainer.

--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills  Staffs  England     /\/\/\/\/
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Reply to
Chris H

The local instructor I am working with is building a simple monitor on the demo board. So far, we have it toggling the leds between red and green and printing the port states to the virtual com port.

PB7 PB6 PB4 PC7 PC6 PC4 PC2 PD5 PD4 PD2 PD1 OFF OFF OFF OFF OFF OFF OFF OFF ON OFF OFF

We are working on commands such as "IN PB7" and "OUT PB7 ON". That should give students a simple way to check out their hardware designs without programming. More advanced students would want to implements their own custom commands for the serial port and spi port.

The basic virtual com port firmware on the AVR takes around 8K, and you can't build any USB device with less than 6K. Since the boot loader itself takes 4K, minimum workable chip is 16K. 32K chip is less than $1 more, so why bother with smaller chips.

Of course, if you are not dealing with USB target, we have some 8K boards (4K user) available for $4.30 (price matching with TI).

See

formatting link

Reply to
linnix

"implementing a simple language" sounds like painting yourself into a corner, if not done very carefully.

If it was me, I'd try and 'hook into' as much tested existing resource as I could, before heading off to plow green fields ;)

Target Source-STEP/Watch debug would be VERY high on that list.

Next would be some PC Source-step ability too, but here a careful subset of any PC language is fine.

-jg

Reply to
-jg

We would not implement a language, but some primitives to be driven by another application/program. For example, "pbx7" toggles I/O direction of port B7, "pb7o" toggles the I/O state of port B7. We expect the application/program/user to remember the last direction/ state.

Using hyperterminal or another program:

pb7xOK p PB7 PB4 PC7 PC6 PC4 PC2 PD5 PD4 PD1 PD0 OUT IN IN IN IN OUT IN IN IN IN OFF OFF OFF OFF OFF ON ON OFF OFF OFF OK pb7oOK p PB7 PB4 PC7 PC6 PC4 PC2 PD5 PD4 PD1 PD0 OUT IN IN IN IN OUT IN IN IN IN ON OFF OFF OFF OFF ON OFF ON OFF OFF OK

Reply to
linnix

But the industry demands higher level skill set.

Are you students capable of VB and VC? Our instructor expects them to drive the demo board with either one using virtual com port on the PC. I will post the firmware (almost done), VC (almost starting) and VB (left for the students to do).

Reply to
linnix

Yes, but this is about introducing people who otherwise might not have any way to even find out if they want to pursue this as a hobby and I'm not even restricting this to people who may make a hobby out of it. All I want to do is open a door and see who walks in and work with them at whatever level they are interested in. If it never becomes more than one of those rare moments where someone has a little bit of fun and never comes back, I'd be happy.

If I never teach a single person who goes into the business ever, I will still be happy. If only one of them decides to make a hobby out of it where they spend more time, I'd still be happy. If no one ever comes back, but at least enjoys the moment and gets a kick out of it and laughs a little... I'd still be happy.

I have no idea who will come in the door. Some might. But it isn't a pre-requisite... that's for sure. I want people with zero VB and zero VC experience finding themselves enjoying the time and wanting to be there.

All help is good.

Thanks, Jon

Reply to
Jon Kirwan

Thanks. I don't think I wrote in a way that disagrees with your caution. Part of working out the scope and details is exploring what has already been done and how well that fits into, or detracts from, what else I'd like to accomplish. Worse, I'm not entirely sure what that goal is, either. It's a moving target right now. What I have to do is narrow this down to something I can clearly visualize and communicate the details about and as I find out what is out there, software and hardware and possible target student interests as well, I will nail this down better. It's all a developing gestalt, of sorts. I'm still waiting to discover the self-organizing point of criticality here; a kind of sudden precipitation that will occur when I nail this in mind.

When that takes place, I will _know_ what is in and what is out; what works and what doesn't. Everything will clarify.

I know some boundaries right now. But the pure sense of inspired vision remains beyond me for the moment. Part of wanting this discussion now is the hope that something, unintended or intended, will resonate and bring forth that precipitation. But one way that has often and reliably pushed me into that insprired realization is setting down and "just doing it." That may be setting down to write code, which may then force me to realize my own limitations better or clarify the goals as I begin to "see" better. That may be just "doing a class" without a plan and see where that takes me, too. I don't like doing that, because it isn't fair to others. But that may be a partial approach to nailing all this down.

One thing your comment suggests, and may be different from what I'm seeking, is the very practical issues that you have to deal with day in and day out and the point that I should use as much as possible -- even things that may not be perfect fits -- just for accomplishment's sake itself. But if I don't make this fun; if the result isn't out and out enjoyment by some grandmothers and some kids alike, then I've not gotten it done right.

I want this to have the possibility of transforming people, who wouldn't otherwise imagine they'd enjoy taking a screwdriver to a doorknob, and get them to find fun and enlightenment in seeing how a doorknob works for the first time in their lives. To discover or rediscover the long lost explorer in themselves.

So unless the tools I find move me clearly in that direction, well...

Jon

Reply to
Jon Kirwan

Students who don't want to program can still test out hardware with a simple virtual terminal (hyperterminal). Perhaps someone can wrote a real virtual terminal that can execute basic scripts.

Reply to
linnix

Hmm. I don't know if you read everything in this thread, but I want the students to take something home and keep it. It is theirs. I want them to have something tangible and to show others, should the mood arise. It needs to be physical and real and __do__ something. Or maybe I'm not following?

Jon

Reply to
Jon Kirwan

You can do whatever fits in 2K. I have the AVRFreaks gcc coding for a few PWMs and some calculation and pin IO in under 512 bytes of code for an ATtiny45. It's pretty -- aggressive -- about inlining. I guess SRAM is even tighter than flash.

Mel.

Reply to
Mel

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.