Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > sci.electronics.design > #545661

Re: Arduino code sources?

Subject Re: Arduino code sources?
Newsgroups sci.electronics.design
References (7 earlier) <S5zIE.567975$iy4.402075@fx06.am4> <qcv3bn$2d7$1@dont-email.me> <LwEIE.2352283$%SF.1777358@fx15.am4> <%yZIE.13612$eW3.12077@fx39.iad> <Xr_IE.47895$NT5.26629@fx47.iad>
From bitrex <user@example.net>
Message-ID <oz%IE.34833$jA4.565@fx07.iad> (permalink)
Organization frugalusenet - www.frugalusenet.com
Date 2019-06-02 22:26 -0400

Show all headers | View raw


On 6/2/19 9:10 PM, Clifford Heath wrote:
> On 3/6/19 10:09 am, bitrex wrote:
>> On 6/1/19 8:13 PM, Tom Gardner wrote:
>>>> There's not that much trouble you can get into on an ATmega, but 
>>>> it's very educational to single-step your code at the assembly 
>>>> level. Plus <stdio.h> isn't that small, so printf() isn't a huge 
>>>> help, and there's no semihosting.
>>>
>>> Just so, on all counts.
>>>
>>> It can be very entertaining looking at heavily optimised
>>> C code, and single stepping it for that matter. Obfuscated
>>> is the word that springs to mind.
>>
>> there are plug-ins for other IDEs you can develop Arduino code with 
>> that will show you the optimized asm your C/C++ code generates for 
>> AVR, ARM, MSP430, MIPS, etc on the fly, in real-time as you type
> 
> I've just hand-built a Makefile for a client's SAMD Arduino project that 
> allows it to be compiled inside an Atmel Studio project so we can debug 
> USB re-enumeration issues. Contrary to what it says on the tin, Atmel 
> Studio cannot create such a Makefile for an Arduino project 
> automatically - it doesn't even get close, I tried.
> 
> I have no idea why the original author thought it was reasonable to 
> attempt to develop a 10KLOC commercial product using Arduino. Least of 
> all a SAMD product - the BOSSA code loader is the biggest load of shite 
> I've come across in years, and the author doesn't seem to even care, so 
> I'll name-and-shame him:
> 
> <https://github.com/shumatech/BOSSA/pull/98>
> 
> Clifford Heath.

I would never try to develop a commercial product that size within the 
Arduino IDE/environment, hell no. It's fine for little jobs and 
proofs-of-concept.

Large projects I write, prototype and debug all the algorithms and 
classes and components, in portable C++, as if I'm writing an 
application for a desktop x86 machine.

Then port it over. I often use tools like Compiler Explorer to look at 
the generated ASM for the AVR or ARM for some functional component if 
I'm unsure of what kind of code will be generated.

Most code even for uPs is processor-agnostic and will comprise only a 
tiny fraction of the execution time of a given program so there's no 
point to try to heavily optimize it for execution speed. The uP-specific 
or Arduino-specific stuff like manipulating pins and reading/writing 
from the serial port, and optimizing those parts if necessary, is the 
last part I work on, once everything else is debugged, checked for 
errors by a static analyzer (as configured by default the Arduino IDE 
SUCKS at reporting potentially catastrophic mistakes), and working as 
near perfect as possible in a test-driven development situation. And 
avr-gcc and arm-gcc tend to generate very compact code, even from 
template-heavy C++11.

Obviously keeping in mind the resource limitations of the processor it 
will end up running on. that's not very hard to do. You can't just use 
dynamically-allocated memory except in certain cases, but sometimes it's 
just fine and helpful. Dynamically allocating a small object that's 
destroyed/deleted at the end of a function call, where ownership of the 
resource-holding pointer isn't transferred anywhere else, isn't really 
any more dangerous than a stack allocation even on an 8 bit machine.

A use case is iterators that allow you to iterate over lists of things 
of arbitrary size without having to hardcode the list size into the 
function call. The dynamically allocated object within a function call 
is the Iterator object. C++ doesn't support variable-length arrays. It's 
good programming practice to never touch raw storage like C-style arrays 
when you just need to look at what is contained, and in C++ it's very 
straightforward to write an iterable List class that can hold lists of 
arbitrary stuff (use a template) of arbitrary size and is very 
efficient, even on 8 bit.

Back to sci.electronics.design | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Arduino code sources? Terry Pinnell <me@somewhere.invalid> - 2019-05-31 11:48 +0100
  Re: Arduino code sources? Cursitor Doom <curd@notformail.com> - 2019-05-31 11:40 +0000
    Re: Arduino code sources? Lasse Langwadt Christensen <langwadt@fonz.dk> - 2019-05-31 05:32 -0700
      Re: Arduino code sources? Winfield Hill <hill@rowland.harvard.edu> - 2019-05-31 06:54 -0700
        Re: Arduino code sources? bitrex <user@example.net> - 2019-05-31 10:46 -0400
          Re: Arduino code sources? bitrex <user@example.net> - 2019-05-31 10:47 -0400
        Re: Arduino code sources? Lasse Langwadt Christensen <langwadt@fonz.dk> - 2019-05-31 07:49 -0700
    Re: Arduino code sources? Peter Percival <peterxpercival@hotmail.com> - 2019-06-12 13:41 +0100
      Re: Arduino code sources? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2019-06-12 21:48 -0400
        Re: Arduino code sources? Peter Percival <peterxpercival@hotmail.com> - 2019-06-13 17:46 +0100
  Re: Arduino code sources? George Herold <gherold@teachspin.com> - 2019-05-31 07:45 -0700
  Re: Arduino code sources? bitrex <user@example.net> - 2019-05-31 11:37 -0400
    Re: Arduino code sources? bitrex <user@example.net> - 2019-05-31 11:39 -0400
      Re: Arduino code sources? Terry Pinnell <me@somewhere.invalid> - 2019-05-31 18:13 +0100
  Re: Arduino code sources? Ralph Mowery <rmowery28146@earthlink.net> - 2019-05-31 15:07 -0400
  Re: Arduino code sources? "John Miles, KE5FX" <jmiles@gmail.com> - 2019-05-31 17:02 -0700
    Re: Arduino code sources? Jan Panteltje <pNaOnStPeAlMtje@yahoo.com> - 2019-06-01 04:57 +0000
      Re: Arduino code sources? bitrex <user@example.net> - 2019-06-01 01:11 -0400
        Re: Arduino code sources? Jan Panteltje <pNaOnStPeAlMtje@yahoo.com> - 2019-06-01 05:56 +0000
      Re: Arduino code sources? "John Miles, KE5FX" <jmiles@gmail.com> - 2019-05-31 23:34 -0700
        Re: Arduino code sources? Jan Panteltje <pNaOnStPeAlMtje@yahoo.com> - 2019-06-01 07:34 +0000
        Re: Arduino code sources? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2019-06-01 06:39 -0400
      Re: Arduino code sources? Tom Gardner <spamjunk@blueyonder.co.uk> - 2019-06-01 07:50 +0100
        Re: Arduino code sources? Jan Panteltje <pNaOnStPeAlMtje@yahoo.com> - 2019-06-01 07:17 +0000
        Re: Arduino code sources? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2019-06-01 06:45 -0400
          Re: Arduino code sources? DecadentLinuxUserNumeroUno@decadence.org - 2019-06-01 11:13 +0000
        Re: Arduino code sources? Clifford Heath <no.spam@please.net> - 2019-06-01 21:06 +1000
          Re: Arduino code sources? Tom Gardner <spamjunk@blueyonder.co.uk> - 2019-06-01 12:33 +0100
            Re: Arduino code sources? DecadentLinuxUserNumeroUno@decadence.org - 2019-06-01 12:03 +0000
              Re: Arduino code sources? Lasse Langwadt Christensen <langwadt@fonz.dk> - 2019-06-01 05:15 -0700
                Re: Arduino code sources? DecadentLinuxUserNumeroUno@decadence.org - 2019-06-02 01:48 +0000
            Re: Arduino code sources? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2019-06-01 11:26 -0400
              Re: Arduino code sources? Tom Gardner <spamjunk@blueyonder.co.uk> - 2019-06-01 19:03 +0100
                Re: Arduino code sources? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2019-06-01 19:56 -0400
                Re: Arduino code sources? Tom Gardner <spamjunk@blueyonder.co.uk> - 2019-06-02 01:13 +0100
                Re: Arduino code sources? bitrex <user@example.net> - 2019-06-02 20:09 -0400
                Re: Arduino code sources? bitrex <user@example.net> - 2019-06-02 20:16 -0400
                Re: Arduino code sources? Clifford Heath <no.spam@please.net> - 2019-06-03 11:10 +1000
                Re: Arduino code sources? bitrex <user@example.net> - 2019-06-02 22:26 -0400
                Re: Arduino code sources? Clifford Heath <no.spam@please.net> - 2019-06-03 12:37 +1000
                Re: Arduino code sources? bitrex <user@example.net> - 2019-06-02 23:14 -0400
                Re: Arduino code sources? Clifford Heath <no.spam@please.net> - 2019-06-03 14:30 +1000
                Re: Arduino code sources? Tom Gardner <spamjunk@blueyonder.co.uk> - 2019-06-03 08:46 +0100
                Re: Arduino code sources? DecadentLinuxUserNumeroUno@decadence.org - 2019-06-03 11:58 +0000
              Re: Arduino code sources? bitrex <user@example.net> - 2019-06-01 17:18 -0400
                Re: Arduino code sources? bitrex <user@example.net> - 2019-06-01 17:24 -0400
                Re: Arduino code sources? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2019-06-01 20:08 -0400
                Re: Arduino code sources? Lasse Langwadt Christensen <langwadt@fonz.dk> - 2019-06-01 17:14 -0700
                Re: Arduino code sources? bitrex <user@example.net> - 2019-06-01 20:26 -0400
          Re: Arduino code sources? "Rodney Pont" <mlist4@infohit.me.uk> - 2019-06-01 15:19 +0100
            Re: Arduino code sources? Clifford Heath <no.spam@please.net> - 2019-06-02 17:42 +1000
              Re: Arduino code sources? "John Miles, KE5FX" <jmiles@gmail.com> - 2019-06-02 01:53 -0700
                Re: Arduino code sources? Clifford Heath <no.spam@please.net> - 2019-06-02 22:46 +1000
          Re: Arduino code sources? Dennis <dennis@none.none> - 2019-06-01 09:43 -0500
            Re: Arduino code sources? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2019-06-01 11:30 -0400
              Re: Arduino code sources? bitrex <user@example.net> - 2019-06-03 00:00 -0400
                Re: Arduino code sources? Jan Panteltje <pNaOnStPeAlMtje@yahoo.com> - 2019-06-03 05:52 +0000
                Re: Arduino code sources? bitrex <user@example.net> - 2019-06-03 11:33 -0400
                Re: Arduino code sources? bitrex <user@example.net> - 2019-06-03 11:41 -0400
                Re: Arduino code sources? pcdhobbs@gmail.com - 2019-06-03 16:29 -0700
                Re: Arduino code sources? bitrex <user@example.net> - 2019-06-04 02:14 -0400
                Re: Arduino code sources? bitrex <user@example.net> - 2019-06-04 02:27 -0400
                Re: Arduino code sources? Tom Gardner <spamjunk@blueyonder.co.uk> - 2019-06-03 08:50 +0100
                Re: Arduino code sources? krw@notreal.com - 2019-06-03 19:12 -0400
              Spot the app note error   was    Arduino code sources? Don Kuenz, KB7RPU <g@crcomp.net> - 2019-06-04 16:03 +0000
                Re: Spot the app note error was Arduino code sources? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2019-06-04 13:17 -0400
                Re: Spot the app note error Don Kuenz <g@crcomp.net> - 2019-06-04 21:47 +0000
                Re: Spot the app note error was Arduino code sources? Don Kuenz <g@crcomp.net> - 2019-06-08 18:34 +0000
                Re: Spot the app note error was Arduino code sources? bitrex <user@example.net> - 2019-06-04 15:30 -0400
                Re: Spot the app note error Don Kuenz, KB7RPU <g@crcomp.net> - 2019-06-04 21:48 +0000
                Re: Spot the app note error Winfield Hill <winfieldhill@yahoo.com> - 2019-06-04 15:51 -0700
                Re: Spot the app note error Don Kuenz, KB7RPU <g@crcomp.net> - 2019-06-04 23:28 +0000
                Re: Spot the app note error Don Kuenz, KB7RPU <g@crcomp.net> - 2019-06-04 23:40 +0000
                Re: Spot the app note error Winfield Hill <winfieldhill@yahoo.com> - 2019-06-04 17:21 -0700
                Re: Spot the app note error Don Kuenz, KB7RPU <g@crcomp.net> - 2019-06-05 01:13 +0000
                Re: Spot the app note error bitrex <user@example.net> - 2019-06-04 23:02 -0400
                Re: Spot the app note error bitrex <user@example.net> - 2019-06-04 23:05 -0400
                Re: Spot the app note error Winfield Hill <winfieldhill@yahoo.com> - 2019-06-05 01:08 -0700
                Re: Spot the app note error bitrex <user@example.net> - 2019-06-06 00:22 -0400
                Re: Spot the app note error bitrex <user@example.net> - 2019-06-06 00:27 -0400
                Re: Spot the app note error Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2019-06-05 22:48 -0400
                Re: Spot the app note error Winfield Hill <winfieldhill@yahoo.com> - 2019-06-07 13:35 -0700
                Re: Spot the app note error Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2019-06-07 20:44 -0400
      Re: Arduino code sources? Cursitor Doom <curd@notformail.com> - 2019-06-01 09:57 +0000
    Re: Arduino code sources? Cursitor Doom <curd@notformail.com> - 2019-06-01 10:06 +0000
      Re: Arduino code sources? "John Miles, KE5FX" <jmiles@gmail.com> - 2019-06-01 15:06 -0700
        Re: Arduino code sources? Jan Panteltje <pNaOnStPeAlMtje@yahoo.com> - 2019-06-02 03:26 +0000
        Re: Arduino code sources? Clifford Heath <no.spam@please.net> - 2019-06-02 17:55 +1000
          Re: Arduino code sources? Jan Panteltje <pNaOnStPeAlMtje@yahoo.com> - 2019-06-02 09:39 +0000
            Re: Arduino code sources? DecadentLinuxUserNumeroUno@decadence.org - 2019-06-02 11:02 +0000
            Re: Arduino code sources? Cursitor Doom <curd@notformail.com> - 2019-06-02 11:43 +0000
            Re: Arduino code sources? Clifford Heath <no.spam@please.net> - 2019-06-02 22:57 +1000
              Re: Arduino code sources? Jan Panteltje <pNaOnStPeAlMtje@yahoo.com> - 2019-06-02 15:05 +0000
                Re: Arduino code sources? Cursitor Doom <curd@notformail.com> - 2019-06-02 17:00 +0000
                Re: Arduino code sources? Clifford Heath <no.spam@please.net> - 2019-06-03 10:07 +1000
                Re: Arduino code sources? Jasen Betts <jasen@xnet.co.nz> - 2019-06-03 00:55 +0000
                Re: Arduino code sources? Jan Panteltje <pNaOnStPeAlMtje@yahoo.com> - 2019-06-03 05:22 +0000
                Re: Arduino code sources? Clifford Heath <no.spam@please.net> - 2019-06-03 11:00 +1000
                Re: Arduino code sources? Jan Panteltje <pNaOnStPeAlMtje@yahoo.com> - 2019-06-03 05:21 +0000
                Re: Arduino code sources? Clifford Heath <no.spam@please.net> - 2019-06-03 17:15 +1000
              Re: Arduino code sources? Cursitor Doom <curd@notformail.com> - 2019-06-02 15:23 +0000
  Re: Arduino code sources? Rheilly Phoull <rheilly@bigslong.com> - 2019-06-01 08:13 +0800
  Re: Arduino code sources? sdy <sdeyoreo@hotmail.com> - 2019-05-31 18:38 -0700
  Re: Arduino code sources? Terry Pinnell <me@somewhere.invalid> - 2019-06-01 11:45 +0100
    Re: Arduino code sources? Tom Gardner <spamjunk@blueyonder.co.uk> - 2019-06-01 12:36 +0100
      Re: Arduino code sources? Terry Pinnell <me@somewhere.invalid> - 2019-06-01 16:04 +0100
    Re: Arduino code sources? Lasse Langwadt Christensen <langwadt@fonz.dk> - 2019-06-01 04:38 -0700
      Re: Arduino code sources? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2019-06-01 11:32 -0400
        Re: Arduino code sources? Tom Gardner <spamjunk@blueyonder.co.uk> - 2019-06-01 19:05 +0100
        Re: Arduino code sources? bitrex <user@example.net> - 2019-06-02 23:52 -0400
          Re: Arduino code sources? Tom Gardner <spamjunk@blueyonder.co.uk> - 2019-06-03 08:53 +0100
    Re: Arduino code sources? Ralph Mowery <rmowery28146@earthlink.net> - 2019-06-01 11:26 -0400
  Re: Arduino code sources? "Rodney Pont" <mlist4@infohit.me.uk> - 2019-06-01 15:11 +0100
    Re: Arduino code sources? Terry Pinnell <me@somewhere.invalid> - 2019-06-01 16:20 +0100
  Re: Arduino code sources? bitrex <user@example.net> - 2019-06-02 23:08 -0400
    Re: Arduino code sources? bitrex <user@example.net> - 2019-06-02 23:40 -0400

csiph-web