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


Groups > sci.electronics.design > #473729 > unrolled thread

Microchip ICD4 ?

Started byMartin Riddle <martin_rid@verizon.net>
First post2017-08-17 13:45 -0400
Last post2017-08-18 12:10 +0100
Articles 20 on this page of 91 — 25 participants

Back to article view | Back to sci.electronics.design


Contents

  Microchip ICD4 ? Martin Riddle <martin_rid@verizon.net> - 2017-08-17 13:45 -0400
    Re: Microchip ICD4 ? DemonicTubes <tlackie@gmail.com> - 2017-08-17 12:17 -0700
      Re: Microchip ICD4 ? Martin Riddle <martin_rid@verizon.net> - 2017-08-17 15:32 -0400
      Re: Microchip ICD4 ? speff <spehro@gmail.com> - 2017-08-17 19:02 -0700
    Re: Microchip ICD4 ? bitrex <bitrex@de.lete.earthlink.net> - 2017-08-17 15:52 -0400
      Re: Microchip ICD4 ? piglet <erichpwagner@hotmail.com> - 2017-08-17 21:23 +0100
        Re: Microchip ICD4 ? boB <boB@k7iq.com> - 2017-08-17 13:42 -0700
        Re: Microchip ICD4 ? Lasse Langwadt Christensen <langwadt@fonz.dk> - 2017-08-17 14:23 -0700
          Re: Microchip ICD4 ? rickman <gnuarm@gmail.com> - 2017-08-17 17:46 -0400
        Re: Microchip ICD4 ? rickman <gnuarm@gmail.com> - 2017-08-17 17:44 -0400
          Re: Microchip ICD4 ? bitrex <bitrex@de.lete.earthlink.net> - 2017-08-17 18:40 -0400
            Re: Microchip ICD4 ? DemonicTubes <tlackie@gmail.com> - 2017-08-17 16:19 -0700
              Re: Microchip ICD4 ? bitrex <bitrex@de.lete.earthlink.net> - 2017-08-17 22:04 -0400
            Re: Microchip ICD4 ? rickman <gnuarm@gmail.com> - 2017-08-17 20:03 -0400
              Re: Microchip ICD4 ? bitrex <bitrex@de.lete.earthlink.net> - 2017-08-17 23:17 -0400
                Re: Microchip ICD4 ? "Michael A. Terrell" <mike.terrell@earthlink.net> - 2017-08-18 07:36 -0400
              Re: Microchip ICD4 ? Paul Rubin <no.email@nospam.invalid> - 2017-08-17 22:50 -0700
                Re: Microchip ICD4 ? Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2017-08-18 14:43 +0100
                Re: Microchip ICD4 ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-08-18 13:42 +0000
                  Re: Microchip ICD4 ? bitrex <bitrex@de.lete.earthlink.net> - 2017-08-18 12:49 -0400
                    Re: Microchip ICD4 ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-08-18 17:11 +0000
                      Re: Microchip ICD4 ? bitrex <bitrex@de.lete.earthlink.net> - 2017-08-18 16:22 -0400
                      Re: Microchip ICD4 ? Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2017-08-19 08:44 +0100
                  Re: Microchip ICD4 ? Paul Rubin <no.email@nospam.invalid> - 2017-08-18 23:19 -0700
                  Re: Microchip ICD4 ? Paul Rubin <no.email@nospam.invalid> - 2017-08-28 00:22 -0700
                    Re: Microchip ICD4 ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-09-02 16:35 +0000
                Re: Microchip ICD4 ? Cecil Bayona <cbayona@cbayona.com> - 2017-08-18 10:58 -0500
                  Re: Microchip ICD4 ? Paul Rubin <no.email@nospam.invalid> - 2017-08-18 09:34 -0700
              Re: Microchip ICD4 ? David Brown <david.brown@hesbynett.no> - 2017-08-18 13:22 +0200
                Re: Microchip ICD4 ? stephen@mpeforth.com (Stephen Pelc) - 2017-08-18 11:54 +0000
                  Re: Microchip ICD4 ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-08-18 14:40 +0000
                  Re: Microchip ICD4 ? Paul Rubin <no.email@nospam.invalid> - 2017-08-18 09:29 -0700
                    Re: Microchip ICD4 ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-08-18 17:06 +0000
                      Re: Microchip ICD4 ? Tom Gardner <spamjunk@blueyonder.co.uk> - 2017-08-18 19:59 +0100
                        Re: Microchip ICD4 ? dplatt@coop.radagast.org (Dave Platt) - 2017-08-18 12:49 -0700
                          Re: Microchip ICD4 ? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-08-19 01:52 +0200
                            Re: Microchip ICD4 ? bitrex <bitrex@de.lete.earthlink.net> - 2017-08-18 20:40 -0400
                              Re: Microchip ICD4 ? bitrex <bitrex@de.lete.earthlink.net> - 2017-08-18 20:43 -0400
                              Re: Microchip ICD4 ? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-08-19 13:03 +0200
                                Re: Microchip ICD4 ? bitrex <bitrex@de.lete.earthlink.net> - 2017-08-19 10:30 -0400
                                  Re: Microchip ICD4 ? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-08-19 21:03 +0200
                          Re: Microchip ICD4 ? Paul Rubin <no.email@nospam.invalid> - 2017-08-18 23:28 -0700
                          Re: Microchip ICD4 ? David Brown <david.brown@hesbynett.no> - 2017-08-21 16:49 +0200
                        Re: Microchip ICD4 ? David Brown <david.brown@hesbynett.no> - 2017-08-21 16:43 +0200
                      Re: Microchip ICD4 ? Paul Rubin <no.email@nospam.invalid> - 2017-08-18 23:26 -0700
                Re: Microchip ICD4 ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-08-18 14:11 +0000
                  Re: Microchip ICD4 ? David Brown <david.brown@hesbynett.no> - 2017-08-18 16:49 +0200
            Re: Microchip ICD4 ? Terry Porter <terry@tjporter.com.au> - 2017-08-18 02:40 +0000
              Re: Microchip ICD4 ? bitrex <bitrex@de.lete.earthlink.net> - 2017-08-17 22:55 -0400
                Re: Microchip ICD4 ? Terry Porter <terry@tjporter.com.au> - 2017-08-18 09:14 +0000
                  Re: Microchip ICD4 ? jack4747@gmail.com - 2017-08-18 03:10 -0700
                    Re: Microchip ICD4 ? Clive Arthur <cliveta@nowaytoday.co.uk> - 2017-08-18 11:38 +0100
                      Re: Microchip ICD4 ? Martin Brown <'''newspam'''@nezumi.demon.co.uk> - 2017-08-18 12:13 +0100
                      Re: Microchip ICD4 ? jack4747@gmail.com - 2017-08-18 04:25 -0700
                        Re: Microchip ICD4 ? Clive Arthur <cliveta@nowaytoday.co.uk> - 2017-08-18 13:43 +0100
                        Re: Microchip ICD4 ? Johann Klammer <klammerj@NOSPAM.a1.net> - 2017-08-18 23:40 +0200
                      Re: Microchip ICD4 ? David Brown <david.brown@hesbynett.no> - 2017-08-18 16:57 +0200
                        Re: Microchip ICD4 ? Przemek Klosowski <przemek@tux.dot.org> - 2017-08-22 03:24 +0000
                      Re: Microchip ICD4 ? bitrex <bitrex@de.lete.earthlink.net> - 2017-08-18 12:32 -0400
                  Re: Microchip ICD4 ? Neon John <no@never.com> - 2017-08-18 10:02 -0400
                    Re: Microchip ICD4 ? bitrex <bitrex@de.lete.earthlink.net> - 2017-08-18 11:02 -0400
                    Re: Microchip ICD4 ? Terry Porter <terry@tjporter.com.au> - 2017-08-20 07:46 +0000
                      Re: Microchip ICD4 ? David Brown <david.brown@hesbynett.no> - 2017-08-21 16:57 +0200
                  Re: Microchip ICD4 ? David Brown <david.brown@hesbynett.no> - 2017-08-18 16:54 +0200
              Re: Microchip ICD4 ? rickman <gnuarm@gmail.com> - 2017-08-17 23:01 -0400
                Re: Microchip ICD4 ? Terry Porter <terry@tjporter.com.au> - 2017-08-18 07:58 +0000
                  Re: Microchip ICD4 ? Paul Rubin <no.email@nospam.invalid> - 2017-08-18 01:19 -0700
                    Re: Microchip ICD4 ? Terry Porter <terry@tjporter.com.au> - 2017-08-18 20:51 +0000
                      Re: Microchip ICD4 ? Paul Rubin <no.email@nospam.invalid> - 2017-08-18 23:35 -0700
                        Re: Microchip ICD4 ? Terry Porter <terry@tjporter.com.au> - 2017-08-20 07:42 +0000
                          Re: Microchip ICD4 ? Paul Rubin <no.email@nospam.invalid> - 2017-08-20 19:49 -0700
                  Re: Microchip ICD4 ? rickman <gnuarm@gmail.com> - 2017-08-18 05:18 -0400
                    Re: Microchip ICD4 ? Terry Porter <terry@tjporter.com.au> - 2017-08-20 07:22 +0000
                      Re: Microchip ICD4 ? rickman <gnuarm@gmail.com> - 2017-08-22 00:08 -0400
                        Re: Microchip ICD4 ? Paul Rubin <no.email@nospam.invalid> - 2017-08-21 22:41 -0700
                          Re: Microchip ICD4 ? Terry Porter <terry@tjporter.com.au> - 2017-08-22 07:28 +0000
                            Re: Microchip ICD4 ? rickman <gnuarm@gmail.com> - 2017-08-23 16:52 -0400
              Re: Microchip ICD4 ? Paul Rubin <no.email@nospam.invalid> - 2017-08-17 22:54 -0700
              Re: Microchip ICD4 ? David Brown <david.brown@hesbynett.no> - 2017-08-18 16:36 +0200
                Re: Microchip ICD4 ? Terry Porter <terry@tjporter.com.au> - 2017-08-20 08:49 +0000
                  Re: Microchip ICD4 ? David Brown <david.brown@hesbynett.no> - 2017-08-21 17:03 +0200
                Re: Microchip ICD4 ? Terry Porter <terry@tjporter.com.au> - 2017-08-26 02:33 +0000
                  Re: Microchip ICD4 ? rickman <gnuarm@gmail.com> - 2017-08-26 01:55 -0400
                  Re: Microchip ICD4 ? Paul Rubin <no.email@nospam.invalid> - 2017-08-27 13:40 -0700
                    Re: Microchip ICD4 ? rickman <gnuarm@gmail.com> - 2017-09-02 12:58 -0400
                  Re: Microchip ICD4 ? David Brown <david.brown@hesbynett.no> - 2017-08-28 16:25 +0200
            Re: Microchip ICD4 ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-08-18 13:28 +0000
      Re: Microchip ICD4 ? speff <spehro@gmail.com> - 2017-08-17 19:09 -0700
      Re: Microchip ICD4 ? TTman <pcw1.cad@ntlworld.com> - 2017-08-18 10:12 +0100
        Re: Microchip ICD4 ? rickman <gnuarm@gmail.com> - 2017-08-18 05:21 -0400
          Re: Microchip ICD4 ? TTman <pcw1.cad@ntlworld.com> - 2017-08-18 12:10 +0100

Page 4 of 5 — ← Prev page 1 2 3 [4] 5  Next page →


#473857

Frombitrex <bitrex@de.lete.earthlink.net>
Date2017-08-18 11:02 -0400
Message-ID<5kDlB.2769$gF2.1754@fx31.iad>
In reply to#473842
On 08/18/2017 10:02 AM, Neon John wrote:
> On 18 Aug 2017 09:14:33 GMT, Terry Porter <terry@tjporter.com.au>
> wrote:
> 
> 
>>> 312 bytes for GCC on that target seems gigantic, regardless. That was
>>> with the -Os size flag, yeah?
>>
>> No, because while -Os does make the binary smaller, it optomizes away the
>> blinking, a common hardware issue.
> 
> Declare the variable volatile and it won't be optimized away.

Remember to reinterpret_cast<volatile unsigned char*>(0x...etc) rather 
than reinterpret_cast<unsigned char*> when casting integer literals that 
correspond to memory-mapped I/O addresses to pointers, too!

[toc] | [prev] | [next] | [standalone]


#474174

FromTerry Porter <terry@tjporter.com.au>
Date2017-08-20 07:46 +0000
Message-ID<59993e59$0$1590$c3e8da3$5496439d@news.astraweb.com>
In reply to#473842
On Fri, 18 Aug 2017 10:02:42 -0400, Neon John wrote:

> On 18 Aug 2017 09:14:33 GMT, Terry Porter <terry@tjporter.com.au> wrote:
> 
> 
>>> 312 bytes for GCC on that target seems gigantic, regardless. That was
>>> with the -Os size flag, yeah?
>>
>>No, because while -Os does make the binary smaller, it optomizes away
>>the blinking, a common hardware issue.
> 
> Declare the variable volatile and it won't be optimized away.

Thanks, I didn't know that.

> 
> Putting my business hat on now, there is no way I'd pay someone to write
> a non-trivial application in asm.

That makes sense to me, and times have moved on. Once Asm was all there 
was.





-- 
Mecrisp-Stellaris Unofficial User Doc: http://128.199.141.78/index.html

[toc] | [prev] | [next] | [standalone]


#474283

FromDavid Brown <david.brown@hesbynett.no>
Date2017-08-21 16:57 +0200
Message-ID<ones3v$cnb$1@dont-email.me>
In reply to#474174
On 20/08/17 09:46, Terry Porter wrote:
> On Fri, 18 Aug 2017 10:02:42 -0400, Neon John wrote:
> 
>> On 18 Aug 2017 09:14:33 GMT, Terry Porter <terry@tjporter.com.au> wrote:
>>
>>
>>>> 312 bytes for GCC on that target seems gigantic, regardless. That was
>>>> with the -Os size flag, yeah?
>>>
>>> No, because while -Os does make the binary smaller, it optomizes away
>>> the blinking, a common hardware issue.
>>
>> Declare the variable volatile and it won't be optimized away.
> 
> Thanks, I didn't know that.

Very often when people say "my code works without optimisation, but does
not work with optimisation enabled", they have forgotten to use
"volatile" appropriately.

Using "volatile" correctly can be difficult - there are things about it
that are often misunderstood.  But it is key to getting embedded C (and
C++) working the way you want.

> 
>>
>> Putting my business hat on now, there is no way I'd pay someone to write
>> a non-trivial application in asm.
> 
> That makes sense to me, and times have moved on. Once Asm was all there 
> was.
> 

Been there, done that, and happy to see those days long gone.  I like to
/read/ the assembly code generated by my C compilers, and occasionally I
need to write a tiny snippet (usually a single instruction) to cover
something that cannot be expressed in C.  But I am glad I no longer have
to write assembly code of any significance.


[toc] | [prev] | [next] | [standalone]


#473855

FromDavid Brown <david.brown@hesbynett.no>
Date2017-08-18 16:54 +0200
Message-ID<on6ur0$8dv$1@dont-email.me>
In reply to#473817
On 18/08/17 11:14, Terry Porter wrote:
> On Thu, 17 Aug 2017 22:55:28 -0400, bitrex wrote:
> 
> 
>>>> My contention is that well-written modern C++1x will destroy any
>>>> handwritten asm or compiled-Forth "macro assembler" program on both
>>>> execution speed and code size for any nontrivial general computing
>>>> task in all but the most extreme edge-cases, even on say AVR 8 bit
>>>> devices.
> 
>> I did handwavy-qualify my statement to "nontrivial" tasks. I'd consider
>> blinking an LED "trivial" and wouldn't doubt asm could beat a compiled
>> language on that one. YMMV.
> 
> My mileage has never varied, assembly always beats a compiled
> language Blinky in code size in my experience.
> 
>>
>> 312 bytes for GCC on that target seems gigantic, regardless. That was
>> with the -Os size flag, yeah?

It is likely that this is standard startup code.  In my tests, I omitted
that - but by default you'll get code to clear the bss, copy initialised
data, etc.  That is all fixed overhead in a normal program, and any
serious assembly code will need something similar.  (On my testing, that
common code was around 80 bytes, not 312 bytes, but details will vary by
compiler.)

> 
> No, because while -Os does make the binary smaller, it optomizes away the 
> blinking, a common hardware issue.
> 

If compiler flags "optimise away" your code, you don't understand how to
program in C.

[toc] | [prev] | [next] | [standalone]


#473799

Fromrickman <gnuarm@gmail.com>
Date2017-08-17 23:01 -0400
Message-ID<on5l20$kjl$1@dont-email.me>
In reply to#473795
Terry Porter wrote on 8/17/2017 10:40 PM:
> On Thu, 17 Aug 2017 18:40:58 -0400, bitrex wrote:
>
>> On 08/17/2017 05:44 PM, rickman wrote:
>>> piglet wrote on 8/17/2017 4:23 PM:
>>>> On 17/08/2017 20:52, bitrex wrote:
>>>>> On 08/17/2017 01:45 PM, Martin Riddle wrote:
>>>>>> Any folks using this ICD4?
>>>>>>
>>>>>> Cheers
>>>>>>
>>>>>>
>>>>> I hope nobody's still writing uP code in asm in the year 2k17.
>>>>
>>>> I do, assembler is the best!
>>>>
>>>> With a good suite of macros can do anything better than them darn
>>>> annoying "high level" languages claim.
>>>
>>> I have often thought of Forth as a macro assembler on steroids.
>>> Mecrisp is being given optimizations that get it even closer to working
>>> in assembler in terms of speed and code size.  Have you ever looked at
>>> it?
>>>
>>>
>> My contention is that well-written modern C++1x will destroy any
>> handwritten asm or compiled-Forth "macro assembler" program on both
>> execution speed and code size for any nontrivial general computing task
>> in all but the most extreme edge-cases, even on say AVR 8 bit devices.
>>
>> There should be a contest! ;-)
>
> Why not, personally I believe that hand wrtten assembly will murder any
> modern C++1x, so here is my challenge.
>
> A human-visible Blinky with the smallest binary size, and without strange
> electrical states on other pins. A 'Blinky" blinks a LED around once a
> second but may be faster or slower as long as it's clearly 'blinking' to
> a human.
>
> The targets:
> MCU		       | Assembly binary size to beat so far:
> 1) STM32F051 Discovery | 32 bytes
> 2) MSP340	       | 14 bytes
>
> Note: The binary sizes above were above hand crafted by Matthias Koch,
> author of Mecrisp, Mecrisp-Stellaris, Mecrisp-Across and many other
> programs.
>
> A personal note, my own efforts are tabled below, both are boring, no
> shortcut tutorial Blinkies:
> Assembly STM32F051 Discovery Blinky: 84 bytes.
> GCC STM32F051 Discovery Blinky: 312 bytes.

Did all of the numbers above include the required startup code?  Or is this 
just for the binary to actually blink the LED, say the equivalent of "main"?

If Mathias coded this, did he also code it in Forth?  He is working on a new 
system that can run on a "host" and generate code to run on a target MSP430. 
  He hasn't even thought about an ARM version yet.

-- 

Rick C

[toc] | [prev] | [next] | [standalone]


#473812

FromTerry Porter <terry@tjporter.com.au>
Date2017-08-18 07:58 +0000
Message-ID<59969e39$0$1499$c3e8da3$5496439d@news.astraweb.com>
In reply to#473799
On Thu, 17 Aug 2017 23:01:21 -0400, rickman wrote:

> Terry Porter wrote on 8/17/2017 10:40 PM:
>> On Thu, 17 Aug 2017 18:40:58 -0400, bitrex wrote:
>>
>>> On 08/17/2017 05:44 PM, rickman wrote:
>>>> piglet wrote on 8/17/2017 4:23 PM:
>>>>> On 17/08/2017 20:52, bitrex wrote:
>>>>>> On 08/17/2017 01:45 PM, Martin Riddle wrote:
>>>>>>> Any folks using this ICD4?
>>>>>>>
>>>>>>> Cheers
>>>>>>>
>>>>>>>
>>>>>> I hope nobody's still writing uP code in asm in the year 2k17.
>>>>>
>>>>> I do, assembler is the best!
>>>>>
>>>>> With a good suite of macros can do anything better than them darn
>>>>> annoying "high level" languages claim.
>>>>
>>>> I have often thought of Forth as a macro assembler on steroids.
>>>> Mecrisp is being given optimizations that get it even closer to
>>>> working in assembler in terms of speed and code size.  Have you ever
>>>> looked at it?
>>>>
>>>>
>>> My contention is that well-written modern C++1x will destroy any
>>> handwritten asm or compiled-Forth "macro assembler" program on both
>>> execution speed and code size for any nontrivial general computing
>>> task in all but the most extreme edge-cases, even on say AVR 8 bit
>>> devices.
>>>
>>> There should be a contest! ;-)
>>
>> Why not, personally I believe that hand wrtten assembly will murder any
>> modern C++1x, so here is my challenge.
>>
>> A human-visible Blinky with the smallest binary size, and without
>> strange electrical states on other pins. A 'Blinky" blinks a LED around
>> once a second but may be faster or slower as long as it's clearly
>> 'blinking' to a human.
>>
>> The targets:
>> MCU		       | Assembly binary size to beat so far:
>> 1) STM32F051 Discovery | 32 bytes 2) MSP340	       | 14 bytes
>>
>> Note: The binary sizes above were above hand crafted by Matthias Koch,
>> author of Mecrisp, Mecrisp-Stellaris, Mecrisp-Across and many other
>> programs.
>>
>> A personal note, my own efforts are tabled below, both are boring, no
>> shortcut tutorial Blinkies:
>> Assembly STM32F051 Discovery Blinky: 84 bytes.
>> GCC STM32F051 Discovery Blinky: 312 bytes.
> 
> Did all of the numbers above include the required startup code?

Yes and exception handling, they're self contained cold bootable 
binaries. Flash them to the targets and the LED will blink.

>  Or is
> this just for the binary to actually blink the LED, say the equivalent
> of "main"?

Definitely not. 

> 
> If Mathias coded this, did he also code it in Forth? 

A Forth Blinky is too big to include in a "smallest size binary contest" 
as the Forth core is also required. Otherwise a Forth Blinky is the 
easiest to make.

> He is working on a
> new system that can run on a "host" and generate code to run on a target
> MSP430.

Yes, I'm evaluating "Mecrisp-Across" at the moment. The binary runs on 
MSP430 targets, but "Mecrisp-Across" is written in Forth and runs on 
Mecrisp-Stellaris, hosted on ARM, be it a RaspberryPI, STM32, TI Tiva 
Connected Launchpad or about 5 other manufacturers ARM products.

>   He hasn't even thought about an ARM version yet.

He has, but because Matthias is a *very* fond of MSP430 Assembly 
and always wanted to make a super optimised tethered Forth compiler, 
MSP430 was a logical choice. I wouldn't hold my breath waiting for a ARM 
version.

He has made Mecrisp-Stellaris for CortexM, it's cold bootable turnkey 
capable and only 19K with the latest RA version and Vocabulary hooks. I 
feel it's very capable, and the price is right.

STM32F CortexM variants with 64K Flash are dirt cheap and what I use. I 
paid $0.56 USD ea for STM32F051 in 32 pin QFN with 64K flash from Avenet 
a couple of years ago.

On the other hand MSP430 are very expensive in comparison to STM32F, so I 
think Mecrisp-Across Forth hosted on ARM and generating binaries for 
MSP430 chips is a great idea.

Mecrisp-Across Forth, apart from generating MSP430 binaries, also allows 
target I/O control via JTAG, which is pretty cool.

Mecrisp-Across, is still very Alpha, but can download it here https://
sourceforge.net/projects/mecrisp/files/mecrisp-across-0.4-
experimental.tar.gz

Cheers,
Terry





-- 
Mecrisp-Stellaris Unofficial User Doc: http://128.199.141.78/index.html

[toc] | [prev] | [next] | [standalone]


#473813

FromPaul Rubin <no.email@nospam.invalid>
Date2017-08-18 01:19 -0700
Message-ID<87inhlgueh.fsf@nightsong.com>
In reply to#473812
Terry Porter <terry@tjporter.com.au> writes:
> A Forth Blinky is too big to include in a "smallest size binary contest" 
> as the Forth core is also required. Otherwise a Forth Blinky is the 
> easiest to make.

A Python blinky is probably easier, though needs a comparatively
powerful MCU.  Here is a Cortex M0-based wearable board that
comes with a Micropython fork pre-installed:

  https://www.adafruit.com/product/3501

It looks like a flash drive when you plug it into a USB port, so you
just drag and drop your Python file to it.

[toc] | [prev] | [next] | [standalone]


#473947

FromTerry Porter <terry@tjporter.com.au>
Date2017-08-18 20:51 +0000
Message-ID<5997535f$0$1499$c3e8da3$5496439d@news.astraweb.com>
In reply to#473813
On Fri, 18 Aug 2017 01:19:34 -0700, Paul Rubin wrote:

> Terry Porter <terry@tjporter.com.au> writes:
>> A Forth Blinky is too big to include in a "smallest size binary
>> contest"
>> as the Forth core is also required. Otherwise a Forth Blinky is the
>> easiest to make.
> 
> A Python blinky is probably easier, though needs a comparatively
> powerful MCU.  Here is a Cortex M0-based wearable board that comes with
> a Micropython fork pre-installed:
> 
>   https://www.adafruit.com/product/3501
> 
> It looks like a flash drive when you plug it into a USB port, so you
> just drag and drop your Python file to it.

It would be for a MicroPython programmer no doubt, but a Blinky is the 
easiest thing to do in Mecrisp-Stellaris Forth for me.

Thanks for the link, that's a impressive product and the ATSAMD21E18
is very impressive, STMicro will have to watch out!









-- 
Mecrisp-Stellaris Unofficial User Doc: http://128.199.141.78/index.html

[toc] | [prev] | [next] | [standalone]


#474019

FromPaul Rubin <no.email@nospam.invalid>
Date2017-08-18 23:35 -0700
Message-ID<871so8njy8.fsf@nightsong.com>
In reply to#473947
Terry Porter <terry@tjporter.com.au> writes:
> It would be for a MicroPython programmer no doubt, but a Blinky is the 
> easiest thing to do in Mecrisp-Stellaris Forth for me.

I think it's easier for most programmers, when you consider the effort
of installing Mecrisp on the board, even if you've done it before.
While with that Gemma board, when you take it out of the package, Micro
Python is already on it.  

I love your Mecrisp site and the way you use Fossil for it.  It would be
nice to have simple flashing instructions for more boards.  Or if
Matthias wanted to sell some boards with Mecrisp already on them, I'd
buy one (or several) to support Mecrisp.

You can get very cheap domain names in some of the new TLD's at
porkbun.com if that's of any interest.

[toc] | [prev] | [next] | [standalone]


#474173

FromTerry Porter <terry@tjporter.com.au>
Date2017-08-20 07:42 +0000
Message-ID<59993d54$0$1590$c3e8da3$5496439d@news.astraweb.com>
In reply to#474019
On Fri, 18 Aug 2017 23:35:43 -0700, Paul Rubin wrote:

> Terry Porter <terry@tjporter.com.au> writes:
>> It would be for a MicroPython programmer no doubt, but a Blinky is the
>> easiest thing to do in Mecrisp-Stellaris Forth for me.
> 
> I think it's easier for most programmers, when you consider the effort
> of installing Mecrisp on the board, even if you've done it before.

Really ?
Ok, I'm a Mecrisp-Stellaris fan, but I've never found it difficult to 
install, and I don't even use Windows or Linux being a FreeBSD user.

It's hard for me to believe that any of the Forth heavy hitters here would
find Mecrisp-Stellaris harder to install than eating apple pie and 
icecream :)

Perhaps it's easier with Freebsd ? I was surprised that Debian doesn't 
have a .DEB for Stlink, and the users have to build one themselves.

But if you have Stlink installed, one just plugs in the USB cable from a 
STM32F Discovery board to your PC, and whilst in the directory that suits 
your chip/board runs a one line command. 15 seconds later you're talking 
to Mecrisp-Stellaris.

> While
> with that Gemma board, when you take it out of the package, Micro Python
> is already on it.

I've looked at Micropython as I'm a curious person, but frankly, it's 
just too complex for me compared to Mecrisp-Stellaris Forth.

> 
> I love your Mecrisp site and the way you use Fossil for it. 

Thanks, it was just my local notes directory while I was learning about 
Forth, and grew from there.
Actually althought I use Fossil everywhere as it's my favorite SCS, the 
Doc Site uses Sphinx (for the doc), but Matthias and I liked the Fossil 
logo so much ...

>It would be
> nice to have simple flashing instructions for more boards.  Or if
> Matthias wanted to sell some boards with Mecrisp already on them, I'd
> buy one (or several) to support Mecrisp.

That would be like taking candy from a baby, I'm sure neither Matthias or 
I would want to do that. Besides Mecrisp-Stellaris is a rapidly evolving 
target with new releases usually every month.

Only a month or two ago Manfred Mahlow, the author of the incredibly 
useful 'e4thcom' terminal added Vocabularies to Mecrisp-Stellaris, his 
package is here. http://128.199.141.78/vocabularies.html#vocs-moder-demo

> 
> You can get very cheap domain names in some of the new TLD's at
> porkbun.com if that's of any interest.

It was never a matter of money, Matthias and I just wanted to keep 
branding out of it. It's just the Mecrisp-Stellaris Doc site, no 
clickies, no advertising, hand written documentation only.

Cheers,
Terry



-- 
Mecrisp-Stellaris Unofficial User Doc: http://128.199.141.78/index.html

[toc] | [prev] | [next] | [standalone]


#474246

FromPaul Rubin <no.email@nospam.invalid>
Date2017-08-20 19:49 -0700
Message-ID<87d17pljnz.fsf@nightsong.com>
In reply to#474173
Terry Porter <terry@tjporter.com.au> writes:
> It's hard for me to believe that any of the Forth heavy hitters here would
> find Mecrisp-Stellaris harder to install than eating apple pie and 
> icecream :)

Well, I'm not a Forth heavy hitter and I haven't looked into it, but I
guess I should do so.  I have a couple of the original TI Stellaris
boards that I've been intending to do that with.

Compared to just plugging a board into my laptop USB port and starting
to use it immediately, any installation at all is an obstacle though.

Python is a much easier to use language than Forth imho, though it's far
less efficient, uses a lot more memory, has unpredictable GC pauses and
all that sort of thing.  

>> cheap domain names
> Matthias and I just wanted to keep branding out of it.  It's just the
> Mecrisp-Stellaris Doc site, no clickies, no advertising, hand written
> documentation only.

Hmm, interesting, I like that approach, though internet hosts tend to
reassign "static" IP addresses once in a while.  I hadn't thought of
a domain name as branding but maybe it is.  Maybe a Forth.org subdomain
would be ok if you can get one?

[toc] | [prev] | [next] | [standalone]


#473818

Fromrickman <gnuarm@gmail.com>
Date2017-08-18 05:18 -0400
Message-ID<on6b4c$b23$1@dont-email.me>
In reply to#473812
Terry Porter wrote on 8/18/2017 3:58 AM:
> On Thu, 17 Aug 2017 23:01:21 -0400, rickman wrote:
>
>> Terry Porter wrote on 8/17/2017 10:40 PM:
>>> On Thu, 17 Aug 2017 18:40:58 -0400, bitrex wrote:
>>>
>>>> On 08/17/2017 05:44 PM, rickman wrote:
>>>>> piglet wrote on 8/17/2017 4:23 PM:
>>>>>> On 17/08/2017 20:52, bitrex wrote:
>>>>>>> On 08/17/2017 01:45 PM, Martin Riddle wrote:
>>>>>>>> Any folks using this ICD4?
>>>>>>>>
>>>>>>>> Cheers
>>>>>>>>
>>>>>>>>
>>>>>>> I hope nobody's still writing uP code in asm in the year 2k17.
>>>>>>
>>>>>> I do, assembler is the best!
>>>>>>
>>>>>> With a good suite of macros can do anything better than them darn
>>>>>> annoying "high level" languages claim.
>>>>>
>>>>> I have often thought of Forth as a macro assembler on steroids.
>>>>> Mecrisp is being given optimizations that get it even closer to
>>>>> working in assembler in terms of speed and code size.  Have you ever
>>>>> looked at it?
>>>>>
>>>>>
>>>> My contention is that well-written modern C++1x will destroy any
>>>> handwritten asm or compiled-Forth "macro assembler" program on both
>>>> execution speed and code size for any nontrivial general computing
>>>> task in all but the most extreme edge-cases, even on say AVR 8 bit
>>>> devices.
>>>>
>>>> There should be a contest! ;-)
>>>
>>> Why not, personally I believe that hand wrtten assembly will murder any
>>> modern C++1x, so here is my challenge.
>>>
>>> A human-visible Blinky with the smallest binary size, and without
>>> strange electrical states on other pins. A 'Blinky" blinks a LED around
>>> once a second but may be faster or slower as long as it's clearly
>>> 'blinking' to a human.
>>>
>>> The targets:
>>> MCU		       | Assembly binary size to beat so far:
>>> 1) STM32F051 Discovery | 32 bytes 2) MSP340	       | 14 bytes
>>>
>>> Note: The binary sizes above were above hand crafted by Matthias Koch,
>>> author of Mecrisp, Mecrisp-Stellaris, Mecrisp-Across and many other
>>> programs.
>>>
>>> A personal note, my own efforts are tabled below, both are boring, no
>>> shortcut tutorial Blinkies:
>>> Assembly STM32F051 Discovery Blinky: 84 bytes.
>>> GCC STM32F051 Discovery Blinky: 312 bytes.
>>
>> Did all of the numbers above include the required startup code?
>
> Yes and exception handling, they're self contained cold bootable
> binaries. Flash them to the targets and the LED will blink.

Then it is not a fair comparison.  A C compiler won't have any way to pare 
down the startup code to eliminate a bunch of initialization that won't be 
needed.  I guess that goes along with the example being rather "trivial".


>>  Or is
>> this just for the binary to actually blink the LED, say the equivalent
>> of "main"?
>
> Definitely not.
>
>>
>> If Mathias coded this, did he also code it in Forth?
>
> A Forth Blinky is too big to include in a "smallest size binary contest"
> as the Forth core is also required. Otherwise a Forth Blinky is the
> easiest to make.

Sorry, that is not the case.  A Forth compiler can compile a stand alone 
executable just like any other compiler.


>> He is working on a
>> new system that can run on a "host" and generate code to run on a target
>> MSP430.
>
> Yes, I'm evaluating "Mecrisp-Across" at the moment. The binary runs on
> MSP430 targets, but "Mecrisp-Across" is written in Forth and runs on
> Mecrisp-Stellaris, hosted on ARM, be it a RaspberryPI, STM32, TI Tiva
> Connected Launchpad or about 5 other manufacturers ARM products.

"But"???  Why "but"?


>>   He hasn't even thought about an ARM version yet.
>
> He has, but because Matthias is a *very* fond of MSP430 Assembly
> and always wanted to make a super optimised tethered Forth compiler,
> MSP430 was a logical choice. I wouldn't hold my breath waiting for a ARM
> version.

Yes, that's what I said.  I asked him and he said it would be a while before 
he considers it.  I assume some if not much of the optimization would be 
different for the two CPUs, so a lot of work for an ARM version.


> He has made Mecrisp-Stellaris for CortexM, it's cold bootable turnkey
> capable and only 19K with the latest RA version and Vocabulary hooks. I
> feel it's very capable, and the price is right.

I know, I've used it... on a Stellaris in fact.


> STM32F CortexM variants with 64K Flash are dirt cheap and what I use. I
> paid $0.56 USD ea for STM32F051 in 32 pin QFN with 64K flash from Avenet
> a couple of years ago.

Oh yeah, I know you.  You are the guy with the web site that only uses the 
IP address.  I'm not good with names when I can't connect faces to them.  I 
was talking to you about adding documentation to your site for the MSP430 
Mecrisp.


> On the other hand MSP430 are very expensive in comparison to STM32F, so I
> think Mecrisp-Across Forth hosted on ARM and generating binaries for
> MSP430 chips is a great idea.

I don't follow the reasoning.  An MSP430 with 128kB of Flash and 16kB of RAM 
is only $2.30.  I think that is affordable for a development system.


> Mecrisp-Across Forth, apart from generating MSP430 binaries, also allows
> target I/O control via JTAG, which is pretty cool.
>
> Mecrisp-Across, is still very Alpha, but can download it here https://
> sourceforge.net/projects/mecrisp/files/mecrisp-across-0.4-
> experimental.tar.gz

I don't have one of the host boards, so I'm going to wait until I have a 
need.  Thanks for the link.

-- 

Rick C

[toc] | [prev] | [next] | [standalone]


#474168

FromTerry Porter <terry@tjporter.com.au>
Date2017-08-20 07:22 +0000
Message-ID<599938a2$0$1590$c3e8da3$5496439d@news.astraweb.com>
In reply to#473818
On Fri, 18 Aug 2017 05:18:06 -0400, rickman wrote:

>> A Forth Blinky is too big to include in a "smallest size binary
>> contest" as the Forth core is also required. Otherwise a Forth Blinky
>> is the easiest to make.
> 
> Sorry, that is not the case.  A Forth compiler can compile a stand alone
> executable just like any other compiler.

I don't use 'a Forth Compiler' I use Mecrisp-Stellaris on CortexM0 and 
have never seen a way to do this, plus it's not mentioned anywhere in the 
Mecrisp-Stellaris documentation, but I'd love to know how.
I'd be grateful if you could show me how to do that with Mecrisp-
Stellaris so I can add your technique to my documentation site.

I can clone the whole system Flash, but that's just a copy which included 
the Forth Core as well.

>> STM32F CortexM variants with 64K Flash are dirt cheap and what I use. I
>> paid $0.56 USD ea for STM32F051 in 32 pin QFN with 64K flash from
>> Avenet a couple of years ago.
> 
> Oh yeah, I know you.  You are the guy with the web site that only uses
> the IP address.  I'm not good with names when I can't connect faces to
> them.  I was talking to you about adding documentation to your site for
> the MSP430 Mecrisp.

I may do a DocSite for Mecrisp-Across once I understand how to use it, 
but I'm not interested in Forth on MSP430 as I told you in before.

However I'm definitely interested in Assembly on MSP430 as I love the 
orthagonal instruction set.

> 
> 
>> On the other hand MSP430 are very expensive in comparison to STM32F, so
>> I think Mecrisp-Across Forth hosted on ARM and generating binaries for
>> MSP430 chips is a great idea.
> 
> I don't follow the reasoning.  An MSP430 with 128kB of Flash and 16kB of
> RAM is only $2.30.  I think that is affordable for a development system.

Even a $20 MCU is cheap compared to a National PACE CPU, but it's still 
four times more expensive than the STM32F051 I use, which also has a lot 
more peripherals than the MSP430.

I will probably never use 128KB of Flash for my Mecrisp-Stellaris Forth 
projects.

For me, 64KB of Flash is plenty.

> 
> 
>> Mecrisp-Across Forth, apart from generating MSP430 binaries, also
>> allows target I/O control via JTAG, which is pretty cool.
>>
>> Mecrisp-Across, is still very Alpha, but can download it here https://
>> sourceforge.net/projects/mecrisp/files/mecrisp-across-0.4-
>> experimental.tar.gz
> 
> I don't have one of the host boards,

Neither do I but I have ordered some MSP430 gear so I can play with 
Mecrisp-Across.

> so I'm going to wait until I have a
> need.  Thanks for the link.

You're welcome.





-- 
Mecrisp-Stellaris Unofficial User Doc: http://128.199.141.78/index.html

[toc] | [prev] | [next] | [standalone]


#474312

Fromrickman <gnuarm@gmail.com>
Date2017-08-22 00:08 -0400
Message-ID<ongagi$ma2$1@dont-email.me>
In reply to#474168
Terry Porter wrote on 8/20/2017 3:22 AM:
> On Fri, 18 Aug 2017 05:18:06 -0400, rickman wrote:
>
>>> A Forth Blinky is too big to include in a "smallest size binary
>>> contest" as the Forth core is also required. Otherwise a Forth Blinky
>>> is the easiest to make.
>>
>> Sorry, that is not the case.  A Forth compiler can compile a stand alone
>> executable just like any other compiler.
>
> I don't use 'a Forth Compiler' I use Mecrisp-Stellaris on CortexM0 and
> have never seen a way to do this, plus it's not mentioned anywhere in the
> Mecrisp-Stellaris documentation, but I'd love to know how.
> I'd be grateful if you could show me how to do that with Mecrisp-
> Stellaris so I can add your technique to my documentation site.
>
> I can clone the whole system Flash, but that's just a copy which included
> the Forth Core as well.

There *are* other Forths in the world than Mecrisp.


>>> STM32F CortexM variants with 64K Flash are dirt cheap and what I use. I
>>> paid $0.56 USD ea for STM32F051 in 32 pin QFN with 64K flash from
>>> Avenet a couple of years ago.
>>
>> Oh yeah, I know you.  You are the guy with the web site that only uses
>> the IP address.  I'm not good with names when I can't connect faces to
>> them.  I was talking to you about adding documentation to your site for
>> the MSP430 Mecrisp.
>
> I may do a DocSite for Mecrisp-Across once I understand how to use it,
> but I'm not interested in Forth on MSP430 as I told you in before.
>
> However I'm definitely interested in Assembly on MSP430 as I love the
> orthagonal instruction set.

"Interested" in what sense?  I don't program in assembly unless it is 
absolutely required.  Much of the Mecrisp source code is assembly, so you 
can certainly look at that.


>>> On the other hand MSP430 are very expensive in comparison to STM32F, so
>>> I think Mecrisp-Across Forth hosted on ARM and generating binaries for
>>> MSP430 chips is a great idea.
>>
>> I don't follow the reasoning.  An MSP430 with 128kB of Flash and 16kB of
>> RAM is only $2.30.  I think that is affordable for a development system.
>
> Even a $20 MCU is cheap compared to a National PACE CPU, but it's still
> four times more expensive than the STM32F051 I use, which also has a lot
> more peripherals than the MSP430.
>
> I will probably never use 128KB of Flash for my Mecrisp-Stellaris Forth
> projects.
>
> For me, 64KB of Flash is plenty.

But you can't host the Mecrisp cross compiler on the STM32F051 can you?  I 
thought it was only on the TI ARM eval board.


>>> Mecrisp-Across Forth, apart from generating MSP430 binaries, also
>>> allows target I/O control via JTAG, which is pretty cool.
>>>
>>> Mecrisp-Across, is still very Alpha, but can download it here https://
>>> sourceforge.net/projects/mecrisp/files/mecrisp-across-0.4-
>>> experimental.tar.gz
>>
>> I don't have one of the host boards,
>
> Neither do I but I have ordered some MSP430 gear so I can play with
> Mecrisp-Across.

I don't understand.  If you don't have the host board, what good will the 
target board do you for looking at the cross compiler?

I am not following the flow of this conversation *at all*.

-- 

Rick C

Presently at Wintercrest Farms
On the centerline of totality since 1998
:)

[toc] | [prev] | [next] | [standalone]


#474317

FromPaul Rubin <no.email@nospam.invalid>
Date2017-08-21 22:41 -0700
Message-ID<871so4kvkw.fsf@nightsong.com>
In reply to#474312
rickman <gnuarm@gmail.com> writes:
> But you can't host the Mecrisp cross compiler on the STM32F051 can
> you?  I thought it was only on the TI ARM eval board. ...
> I am not following the flow of this conversation *at all*.

Terry posted a few days ago:

  Yes, I'm evaluating "Mecrisp-Across" at the moment. The binary runs on
  MSP430 targets, but "Mecrisp-Across" is written in Forth and runs on
  Mecrisp-Stellaris, hosted on ARM, be it a RaspberryPI, STM32, TI Tiva
  Connected Launchpad or about 5 other manufacturers ARM products.

I tried running Mecrisp-Stellaris on a remote ARM Linux server a while
back and it had some problems at the time, but I might try again.
Or maybe you could run it on an x86 emulating an ARM under QEMU.

[toc] | [prev] | [next] | [standalone]


#474323

FromTerry Porter <terry@tjporter.com.au>
Date2017-08-22 07:28 +0000
Message-ID<599bdd23$0$11089$c3e8da3@news.astraweb.com>
In reply to#474317
On Mon, 21 Aug 2017 22:41:51 -0700, Paul Rubin wrote:

> rickman <gnuarm@gmail.com> writes:
>> But you can't host the Mecrisp cross compiler on the STM32F051 can you?
>>  I thought it was only on the TI ARM eval board. ...
>> I am not following the flow of this conversation *at all*.
> 
> Terry posted a few days ago:
> 
>   Yes, I'm evaluating "Mecrisp-Across" at the moment. The binary runs on
>   MSP430 targets, but "Mecrisp-Across" is written in Forth and runs on
>   Mecrisp-Stellaris, hosted on ARM, be it a RaspberryPI, STM32, TI Tiva
>   Connected Launchpad or about 5 other manufacturers ARM products.
> 
> I tried running Mecrisp-Stellaris on a remote ARM Linux server a while
> back and it had some problems at the time, but I might try again.
> Or maybe you could run it on an x86 emulating an ARM under QEMU.

Yes, you can definitely run it under QEMU on Linux. I tried it with qemu-
arm-static on Freebsd but while it ran, it did segfault under some 
conditions.

One advantage of the TI Tiva Connected Launchpad over the other 
alternatives is that Matthias has written a JTAG programmer Word for it 
so programs generated by Mecrisp-Across can be flashed to a MSP430 target 
chip.

I have my TI Tiva Connected Launchpad now and will try Mecrisp-Across on 
it soon.

At the moment I'm having a too much fun with Mspdebug on a MSP430 
launchpad to try the TI Tiva Connected sysem ;-)



-- 
Mecrisp-Stellaris Unofficial User Doc: http://128.199.141.78/index.html

[toc] | [prev] | [next] | [standalone]


#474533

Fromrickman <gnuarm@gmail.com>
Date2017-08-23 16:52 -0400
Message-ID<onkplu$271$2@dont-email.me>
In reply to#474323
Terry Porter wrote on 8/22/2017 3:28 AM:
> On Mon, 21 Aug 2017 22:41:51 -0700, Paul Rubin wrote:
>
>> rickman <gnuarm@gmail.com> writes:
>>> But you can't host the Mecrisp cross compiler on the STM32F051 can you?
>>>  I thought it was only on the TI ARM eval board. ...
>>> I am not following the flow of this conversation *at all*.
>>
>> Terry posted a few days ago:
>>
>>   Yes, I'm evaluating "Mecrisp-Across" at the moment. The binary runs on
>>   MSP430 targets, but "Mecrisp-Across" is written in Forth and runs on
>>   Mecrisp-Stellaris, hosted on ARM, be it a RaspberryPI, STM32, TI Tiva
>>   Connected Launchpad or about 5 other manufacturers ARM products.
>>
>> I tried running Mecrisp-Stellaris on a remote ARM Linux server a while
>> back and it had some problems at the time, but I might try again.
>> Or maybe you could run it on an x86 emulating an ARM under QEMU.
>
> Yes, you can definitely run it under QEMU on Linux. I tried it with qemu-
> arm-static on Freebsd but while it ran, it did segfault under some
> conditions.
>
> One advantage of the TI Tiva Connected Launchpad over the other
> alternatives is that Matthias has written a JTAG programmer Word for it
> so programs generated by Mecrisp-Across can be flashed to a MSP430 target
> chip.
>
> I have my TI Tiva Connected Launchpad now and will try Mecrisp-Across on
> it soon.
>
> At the moment I'm having a too much fun with Mspdebug on a MSP430
> launchpad to try the TI Tiva Connected sysem ;-)

I thought you didn't mess with the MSP430?

-- 

Rick C

Viewed the eclipse at Wintercrest Farms,
on the centerline of totality since 1998

[toc] | [prev] | [next] | [standalone]


#473807

FromPaul Rubin <no.email@nospam.invalid>
Date2017-08-17 22:54 -0700
Message-ID<8760dlqv39.fsf@nightsong.com>
In reply to#473795
Terry Porter <terry@tjporter.com.au> writes:
>> My contention is that well-written modern C++1x will destroy any
>> handwritten asm or compiled-Forth "macro assembler" program on both
>> execution speed and code size for any nontrivial general computing task

> MCU		       | Assembly binary size to beat so far:
> 1) STM32F051 Discovery | 32 bytes
> 2) MSP340	       | 14 bytes

I wouldn't call an MCU blinky a nontrivial general computing task.
This might be a better candidate, an XML parser written in x86 asm:

  http://tibleiz.net/asm-xml/

It's faster than the usual C libraries, partly because it processes the
whole file in memory at once instead of as an event stream.  It would be
interesting to find out how a C++ program written with the same approach
as the asm version would compare.

[toc] | [prev] | [next] | [standalone]


#473850

FromDavid Brown <david.brown@hesbynett.no>
Date2017-08-18 16:36 +0200
Message-ID<on6tpb$54s$1@dont-email.me>
In reply to#473795
On 18/08/17 04:40, Terry Porter wrote:
> On Thu, 17 Aug 2017 18:40:58 -0400, bitrex wrote:
> 
>> On 08/17/2017 05:44 PM, rickman wrote:
>>> piglet wrote on 8/17/2017 4:23 PM:
>>>> On 17/08/2017 20:52, bitrex wrote:
>>>>> On 08/17/2017 01:45 PM, Martin Riddle wrote:
>>>>>> Any folks using this ICD4?
>>>>>>
>>>>>> Cheers
>>>>>>
>>>>>>
>>>>> I hope nobody's still writing uP code in asm in the year 2k17.
>>>>
>>>> I do, assembler is the best!
>>>>
>>>> With a good suite of macros can do anything better than them darn
>>>> annoying "high level" languages claim.
>>>
>>> I have often thought of Forth as a macro assembler on steroids. 
>>> Mecrisp is being given optimizations that get it even closer to working
>>> in assembler in terms of speed and code size.  Have you ever looked at
>>> it?
>>>
>>>
>> My contention is that well-written modern C++1x will destroy any
>> handwritten asm or compiled-Forth "macro assembler" program on both
>> execution speed and code size for any nontrivial general computing task
>> in all but the most extreme edge-cases, even on say AVR 8 bit devices.
>>
>> There should be a contest! ;-)
> 
> Why not, personally I believe that hand wrtten assembly will murder any 
> modern C++1x, so here is my challenge.
> 
> A human-visible Blinky with the smallest binary size, and without strange 
> electrical states on other pins. A 'Blinky" blinks a LED around once a 
> second but may be faster or slower as long as it's clearly 'blinking' to 
> a human.
> 
> The targets: 
> MCU		       | Assembly binary size to beat so far:
> 1) STM32F051 Discovery | 32 bytes
> 2) MSP340	       | 14 bytes
> 
> Note: The binary sizes above were above hand crafted by Matthias Koch, 
> author of Mecrisp, Mecrisp-Stellaris, Mecrisp-Across and many other 
> programs.
> 
> A personal note, my own efforts are tabled below, both are boring, no 
> shortcut tutorial Blinkies:
> Assembly STM32F051 Discovery Blinky: 84 bytes.
> GCC STM32F051 Discovery Blinky: 312 bytes.
> 

This is, of course, a completely pointless "contest".  It is like trying
to compare two athletes in a 2 metre sprint.

But just for a laugh, I tried to get a minimum msp430 blinky program.  I
picked an msp430f2619 device, because I have one, and port 2 pin 0 for
the LED (driving 0 to turn the LED on).  I have not tested the code at all.

I got 22 bytes with C code:

#include <stdbool.h>
#include <msp430.h>
#include <stdint.h>

uint8_t resetCounter;

void __attribute__((naked)) xreset(void) {
    resetCounter++;
    if (resetCounter & 0x20) {
        P2DIR = 0x01;
    }
    while (true) {
        // Wait for reset
    }
}


00002100 <reset>:
    2100:	5f 42 00 11 	mov.b	&0x1100,r15	
    2104:	5f 53       	inc.b	r15		
    2106:	c2 4f 00 11 	mov.b	r15,	&0x1100	
    210a:	3f f0 20 00 	and	#32,	r15	;#0x0020
    210e:	02 24       	jz	$+6      	;abs 0x2114
    2110:	d2 43 2a 00 	mov.b	#1,	&0x002a	;r3 As==01
    2114:	ff 3f       	jmp	$+0      	;abs 0x2114


Compiled with:

msp430-gcc blink.c -mmcu=msp430f2619 -nostartfiles -nodefaultlibs
-nostdlib -Os


The program relies on the watchdog to reset the chip after approximately
30 milliseconds, and has the LED on for 32 rounds, then off for 32
rounds, for around 1 second blink.


I am curious about assembly code that will beat that.

[toc] | [prev] | [next] | [standalone]


#474176

FromTerry Porter <terry@tjporter.com.au>
Date2017-08-20 08:49 +0000
Message-ID<59994d24$0$1590$c3e8da3$5496439d@news.astraweb.com>
In reply to#473850
On Fri, 18 Aug 2017 16:36:26 +0200, David Brown wrote:


> But just for a laugh, I tried to get a minimum msp430 blinky program.  I
> picked an msp430f2619 device, because I have one, and port 2 pin 0 for
> the LED (driving 0 to turn the LED on).  I have not tested the code at
> all.
> 
> I got 22 bytes with C code:
> 
> #include <stdbool.h>
> #include <msp430.h>
> #include <stdint.h>
> 
> uint8_t resetCounter;
> 
> "  {
>     resetCounter++;
>     if (resetCounter & 0x20) {
>         P2DIR = 0x01;
>     }
>     while (true) {
>         // Wait for reset
>     }
> }
> 
> 
> 00002100 <reset>:
>     2100:	5f 42 00 11 	mov.b	&0x1100,r15 2104:	5f 
53       	inc.b	r15
>     2106:	c2 4f 00 11 	mov.b	r15,	&0x1100 210a:	3f f0 20 
00 	and	#32,
>     r15	;#0x0020 210e:	02 24       	jz	$+6      
	;abs 0x2114 2110:	d2 43
>     2a 00 	mov.b	#1,	&0x002a	;r3 As==01 2114:	ff 
3f       	jmp	$+0      
>     ;abs 0x2114
> 
> 
> Compiled with:
> 
> msp430-gcc blink.c -mmcu=msp430f2619 -nostartfiles -nodefaultlibs
> -nostdlib -Os
> 
> 
> The program relies on the watchdog to reset the chip after approximately
> 30 milliseconds, and has the LED on for 32 rounds, then off for 32
> rounds, for around 1 second blink.
> 
> 
> I am curious about assembly code that will beat that.

Excellent, Thanks for such a complete and easy to reproduce followup :)

I'm waiting for some MSP430 boards and chips I ordered last week (I'm in 
Australia and these are coming from Hong Kong), but when they arrive, I 
promise to run your code, and if I'm not waiting for anyone else, I'll 
publish the MSP430 assembly code that binks in 14 bytes.

(It's not my code, I'm not a MSP430 Assembly Wizard)

P.S. I'm just curious, is "void __attribute__((naked)) xreset(void)" a 
assembly statement or a C statement ? ;-)

Cheers,
Terry






-- 
Mecrisp-Stellaris Unofficial User Doc: http://128.199.141.78/index.html

[toc] | [prev] | [next] | [standalone]


Page 4 of 5 — ← Prev page 1 2 3 [4] 5  Next page →

Back to top | Article view | sci.electronics.design


csiph-web