Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > sci.electronics.design > #474285
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Newsgroups | sci.electronics.design, comp.lang.forth |
| Subject | Re: Microchip ICD4 ? |
| Date | 2017-08-21 17:03 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <onesft$e1r$1@dont-email.me> (permalink) |
| References | (3 earlier) <on52f0$4ou$1@dont-email.me> <_XolB.2447$kJ2.2238@fx33.iad> <59965381$0$1499$c3e8da3$5496439d@news.astraweb.com> <on6tpb$54s$1@dont-email.me> <59994d24$0$1590$c3e8da3$5496439d@news.astraweb.com> |
Cross-posted to 2 groups.
On 20/08/17 10:49, Terry Porter wrote:
> 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 :)
Just to be clear, I am not recommending the above code as a good example
of C programming! Basing your timing on watchdog resets is rarely
considered good practice - this is just a minimal example.
And if you want to try it out, you will have to change the port used to
match the board as well as changing the "-mmcu" flag to match the real
device.
>
> 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 does not look like anyone else is taking your challenge.
>
> (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 ? ;-)
>
It is a C statement, for the start of a function called "xreset" that
takes no parameters and has no return value. The
"__attribute__((naked))" part is a gcc extension, telling the compiler
not to generate function prologue or epilogue code to keep it minimal.
Back to sci.electronics.design | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
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
csiph-web