EmbeddedRelated.com
Forums
Memfault Beyond the Launch

start whit micro

Started by Silvanononvalevoleciccioli March 18, 2013
On 3/18/2013 7:15 AM, Silvanononvalevoleciccioli wrote:
> hi > I want to start with the micro, can you suggest some things > I think to arduino uno starter kit It's a good idea or not > thanks and bye
Start with defining the problem. What are you going to do with the micro? Which one to start with is largely unimportant. Whatever you do you will be fucked.
BartC wrote:
> > > "Ivan Shmakov" <oneingray@gmail.com> wrote in message > news:87zjxydqtn.fsf_-_@violet.siamics.net... >>>>>>> Joerg Schmitz-Linneweber <joerg@schmitz-linneweber.name> writes: >>>>>>> Am 18.03.2013 13:15, schrieb Silvanononvalevoleciccioli: >> >> [Cross-posting to news:comp.lang.c.] >> >> >> I want to start with the micro, can you suggest some things I think >> >> to arduino uno starter kit It's a good idea or not thanks and bye >> >> > "mbed" [ http://www.mbed.org ] Would be another option... >> >> > * No need for dedicated toolchains but standard C (or even C++) >> > programming. >> >> Indeed, I've just discovered that they use a specific "Arduino" >> (e. g., [1]) language for the "sketches." >> >> The question is: how this language is different from C (it >> surely looks "C-like" enough), and is there any reason to prefer >> it over the latter, even if only for 8-bit AVR programming? > > I looked at this recently (http://arduino.cc/en/Reference/HomePage). Any > resemblance to C is purely superficial (there don't seem to be any user > functions for example). And in the implementation I saw, it just got > converted to C behind the scenes (where I believe gcc was then used to > compile to machine instructions). > > If you know C then just use that instead, if you can figure out how to > use the tools. >
I noticed yesterday that Atmel Studio 6.1 can create a project for an Arduino Due/X board.
In comp.infosystems.www.misc, Ivan Shmakov  <oneingray@gmail.com> wrote:
> Any idea why this site (or, rather, http://mbed.org/ it > redirects to) reports 403 Forbidden when there's > User-Agent: Lynx... in the HTTP request header? Also strange is > that http://www.wescottdesign.com/ results in 406 Not Acceptable > in such a case...
Both sites seem to dislike that Lynx has "libwww" in the User-Agent string. Seems to be a crude anti-robot measure. I could duplicate the problem with lynx -useragent='libwww' But not with either of: lynx -useragent='libww' lynx -useragent='ibwww' Elijah ------ has seen this sort of thing before
Ivan Shmakov wrote:

> Aren't Arduino boards "free hardware" (as in freedom)? Isn't > anyone thus permitted to produce them, or compatible ones? > (ISTR, that I've seen some at Olimex.)
I have in my hand a Chinese Arduino UNO. One of the local hackerspaces built them into convention badges, and sourced these to keep the cost to what they could afford. At least they told me it's Chinese. All the board artwork has been copied 100%, from what I can see. I see Active Tech up here is offering Arduino compatibles from OSEPP and Solarbotics. Mel.
>>>>> BartC <bc@freeuk.com> writes: >>>>> Ivan Shmakov <oneingray@gmail.com> wrote... >>>>> Joerg Schmitz-Linneweber <joerg@schmitz-linneweber.name> writes:
[...] >>> * No need for dedicated toolchains but standard C (or even C++) >>> programming. >> Indeed, I've just discovered that they use a specific "Arduino" >> (e. g., [1]) language for the "sketches." >> The question is: how this language is different from C (it surely >> looks "C-like" enough), and is there any reason to prefer it over >> the latter, even if only for 8-bit AVR programming? > I looked at this recently (http://arduino.cc/en/Reference/HomePage). > Any resemblance to C is purely superficial (there don't seem to be > any user functions for example). And in the implementation I saw, it > just got converted to C behind the scenes (where I believe gcc was > then used to compile to machine instructions). Well, as I was able to figure out, it /is/ indeed converted to C++. The conversion is (as per Arduino.mk from [2], which is itself derived from [3]): # the ino -> cpp -> o file $(OBJDIR)/%.cpp: %.ino $(ECHO) '#include <Arduino.h>' > $@ $(CAT) $< >> $@ Naturally, Arduino.mk also makes sure that a number of include directories are added to the search path, and that a number of libraries are compiled and linked into the resulting binary. [2] http://packages.debian.org/wheezy/arduino-mk [3] http://mjo.tc/atelier/2009/02/arduino-cli.html > If you know C then just use that instead, if you can figure out how > to use the tools. ... When last year I've ordered my Arduino Uno board (which I haven't found much use to this day), it made me wonder, who'd need that 32 KiB program memory ATmega328P MCU? Now, I've tried to build this simply-looking 540-line code [4] (with -Os and -mmcu=atmega8, = 8 KiB) and got the following from the linker: /usr/lib/gcc/avr/4.7.0/../../../avr/bin/ld: ArduinoISP section `.text' will not fit in region `text' /usr/lib/gcc/avr/4.7.0/../../../avr/bin/ld: region `text' overflowed by 7112 bytes collect2: error: ld returned 1 exit status make: *** [ArduinoISP] Error 1 I understand that there may be certain advantage in using the libraries they supply. But somehow, I feel that I should try rewriting this particular piece of code in C, with AVR Libc as the only library used... [4] https://github.com/rsbohn/ArduinoISP/blob/master/ArduinoISP/ArduinoISP.ino -- FSF associate member #7257
Ivan Shmakov w
> Indeed, I've just discovered that they use a specific "Arduino" > (e. g., [1]) language for the "sketches." > > The question is: how this language is different from C (it > surely looks "C-like" enough), and is there any reason to prefer > it over the latter, even if only for 8-bit AVR programming?
It's C with a small injection of C++ for the libraries. Some "hidden headers" supply types like "byte" and "word" where a mainstream programmer would use "uint8_t" and "uint16_t"; and instead of writing a "main" function, the programmer writes "setup" and "loop" functions which get wrapped into the actual program as void main (void) { setup(); for (;;) loop (); } A real beginner would prefer it because it's wrapped into a complete Arduino IDE along with peripheral libraries and a bootloader. This provides everything needed to create a simple project with sensors, actuators and what not. A sophisticated user is liable to find that the Arduino packaging has expropriated some resources and tied the designer's hands. That's when it's time to either replace the Arduino firmware totally with one's own, or get down and design ones own board. I've put a sketch of my own at <http://www.melwilsonsoftware.ca/wiz5100/> for an illustration of what can be done. Another Arduino-based project is at <http://codeshield.diyode.com/> Mel.
On 20.3.13 7:24 , Rich Webb wrote:
> On Wed, 20 Mar 2013 18:40:59 +0200, Tauno Voipio > <tauno.voipio@notused.fi.invalid> wrote: > >> On 20.3.13 6:02 , Rich Webb wrote: >>> On Tue, 19 Mar 2013 16:02:52 -0700 (PDT), info@quantum-leaps.com >>> wrote: >>> >>> The Cortex-M processors are my own go-to choice nowadays. >>> Nevertheless, I would not recommend them as a typical user's first >>> "bare" microcontroller. Better to go with something like an AVR >>> ATmega328 in DIP form-factor. Cheap, understandable, bread-boardable. >>> There is also a choice of free (libre) and free (for non-commercial >>> use) compilers, e.g., https://www.imagecraft.com/ >> >> >> For moving later up to ARMs (including Cortexes), the avr-gcc might >> be a good chioce for a toolkit. AVRdude functions well for programming. >> >> IIRC, there are instructions how to integrate Eclipse and AVR GCC + >> tools, for the IDE people. > > Yes. I'd also thought about recommending WinAVR but from a quick check > of the d/l page it looks like WinAVR stalled about three years ago. > > Doesn't Atmel's AVR Studio include the gcc toolchain, now? I'll admit > that I haven't been keeping up with it -- still running Studio 4 for > those rare occasions when I need it.
No idea - I have not touched AVR Studio in years. My development runs on Ubuntu 12.04 LTS Linux with avr-gcc (and arm-eabi-gcc). If an IDE is desired, Eclipse takes all flavors of GCC pretty easily. -- Tauno
In comp.arch.embedded Ivan Shmakov <oneingray@gmail.com> wrote:
> I understand that there may be certain advantage in using the > libraries they supply. But somehow, I feel that I should try > rewriting this particular piece of code in C, with AVR Libc as > the only library used...
I've been using an Arduino Due (Cortex M0) for prototyping purposes: 1. The board is cheap enough for a 1-off compared with the time of messing about with the toolchain. Untar toolchain, run ./arduino, select example code, press download button, board is programmed. It's that straightforward. 2. The documentation often says things like 'Arduino ...' when it actually means 'AVR Arduino ...'. The documentation for Due is very patchy. I've had to do rather more googling and making random guesses than I would like. While I /can/ go bare metal on it, it's not worth the extra time involved. I'm shipping exactly one unit of this thing, so time is the major factor here. I've done some fairly complex things (multiplexed LEDs hung off timer interrupts) in a few lines of code. Theo
>>>>> Theo Markettos <theom+news@chiark.greenend.org.uk> writes: >>>>> In comp.arch.embedded Ivan Shmakov <oneingray@gmail.com> wrote:
>> I understand that there may be certain advantage in using the >> libraries they supply. But somehow, I feel that I should try >> rewriting this particular piece of code in C, with AVR Libc as the >> only library used... (I've used the "plain C" AVRUSB500 firmware instead.) > I've been using an Arduino Due (Cortex M0) for prototyping purposes: First of all, ARM-based boards seem like a different league. To drive, say, an ATmega8, in PDIP, placed on a breadboard, one'd need only a resistor and a button (for the /Reset line; and even these are optional.) It isn't that simple for ARM's. > 1. The board is cheap enough for a 1-off compared with the time of > messing about with the toolchain. Untar toolchain, But then, doesn't every other contemporary OS include some kind of package management software? Thus making downloading and installing GCC (whether AVR, ARM, "native," or some other variety) essentially a "single-click" operation. (The same applies to the Arduino IDE, though.) > run ./arduino, select example code, press download button, board is > programmed. It's that straightforward. > 2. The documentation often says things like 'Arduino ...' when it > actually means 'AVR Arduino ...'. The documentation for Due is very > patchy. I've had to do rather more googling and making random > guesses than I would like. My understanding is that the Arduino project relies heavily on the community for the documentation, etc. It may thus be beneficial to edit their Wiki pages as you go. > While I /can/ go bare metal on it, it's not worth the extra time > involved. I tend to agree, as long as the ARM variety is considered. > I'm shipping exactly one unit of this thing, so time is the major > factor here. I've done some fairly complex things (multiplexed LEDs > hung off timer interrupts) in a few lines of code. Well, the point of my question was: could someone please share such "complex things in a few lines of Arduino code" examples? TIA. -- FSF associate member #7257 np. Epilogue (Relief) -- Apocalyptica
>>>>> Mel Wilson <mwilson@the-wire.com> writes: >>>>> Ivan Shmakov w
>> Indeed, I've just discovered that they use a specific "Arduino" >> (e. g., [1]) language for the "sketches." >> The question is: how this language is different from C (it surely >> looks "C-like" enough), and is there any reason to prefer it over >> the latter, even if only for 8-bit AVR programming? > It's C with a small injection of C++ for the libraries. AIUI, it's more like "full" C++, adorned with certain libraries, implemented in both C++ and C. > Some "hidden headers" Which, however, may be requested explicitly with: #include <Arduino.h> > supply types like "byte" and "word" where a mainstream programmer > would use "uint8_t" and "uint16_t"; and instead of writing a "main" > function, the programmer writes "setup" and "loop" functions which > get wrapped into the actual program as > void main (void) { > setup (); > for (;;) > loop (); > } Curiously, how it makes it any simpler? > A real beginner would prefer it because it's wrapped into a complete > Arduino IDE along with peripheral libraries and a bootloader. This > provides everything needed to create a simple project with sensors, > actuators and what not. The Optiboot bootloader seems a sane choice, whether used with or without either the Arduino board or Arduino IDE (or both.) Also, AIUI, it's possible (even if tricky) to use the Arduino libraries without either the board or IDE (or both.) There's also the "Arduino from the command line" package [2], which offers a specific Makefile, suitable for turning an Arduino sketch into a "stand-alone" source package. [2] http://mjo.tc/atelier/2009/02/arduino-cli.html > A sophisticated user is liable to find that the Arduino packaging has > expropriated some resources and tied the designer's hands. That's > when it's time to either replace the Arduino firmware totally with > one's own, or get down and design ones own board. The question is: how sensible is to use Arduino libraries without the board? (Again, I see no compelling reason to forgo the Optiboot bootloader specifically.) > I've put a sketch of my own at > <http://www.melwilsonsoftware.ca/wiz5100/> for an illustration of > what can be done. Well, some three years ago, in 2010, one of my students built an NTP clock, following the design by Guido Socher [3]. We've then tweaked the firmware so it'd catch NTP packets broadcast via IPv6 (instead of querying a specific NTP server via IPv4.) [3] http://www.tuxgraphics.org/electronics/200710/avr-ntp-clock.shtml > Another Arduino-based project is at <http://codeshield.diyode.com/> ACK, thanks for the pointer. -- FSF associate member #7257 np. Tree of Love -- Jami Sieber

Memfault Beyond the Launch