You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by "David G. Simmons" <sa...@mac.com> on 2016/11/11 18:18:07 UTC

OS Event Queue errors in blinky

I've gotten the blinky app up on the Arduino Zero Pro, and just for fun, I enabled the Console and shell, hooked it up to my FT232H and got ...

200976:Assert ; failed in os_eventq.c:314
200976:Unhandled interrupt (2), exception sp 0x20007f48
200976: r0:0x00000000  r1:0x00000000  r2:0x80000000  r3:0xe000ed00
200976: r4:0x00000000  r5:0x0000013a  r6:0x00016200  r7:0x00000003
200976: r8:0x000927c0  r9:0x0000ca61 r10:0xbffd8dd3 r11:0xd6beeff1
200976:r12:0xfffff7fe  lr:0x0000d1bd  pc:0x0000d1ca psr:0x8100001b
200976:ICSR:0x0440f002

Now, the blinky app is still running just fine, but from os_eventq.c, line 314:

if (*evq == NULL) {
        eventq_dflt = os_eventq_dflt_get();
        if (eventq_dflt != NULL) {
            os_eventq_designate(evq, eventq_dflt, start_ev);
        }

        /* The system is misconfigured if there is still no parent eventq.  The
         * application should have explicitly specified a parent queue for each
         * package, or indicated a default.
         */
        assert(*evq != NULL);

--
David G. Simmons
(919) 534-5099
Web <https://davidgs.com/> • Blog <https://davidgs.com/davidgs_blog> • Linkedin <http://linkedin.com/in/davidgsimmons> • Twitter <http://twitter.com/TechEvangelist1> • GitHub <http://github.com/davidgs>
/** Message digitally signed for security and authenticity.  
* If you cannot read the PGP.sig attachment, please go to 
 * http://www.gnupg.com/ <http://www.gnupg.com/> Secure your email!!!
 * Public key available at keyserver.pgp.com <http://keyserver.pgp.com/>
**/
♺ This email uses 100% recycled electrons. Don't blow it by printing!

There are only 2 hard things in computer science: Cache invalidation, naming things, and off-by-one errors.



Re: OS Event Queue errors in blinky

Posted by aditi hilbert <ad...@runtime.io>.
Hi David,

Is there a reason you want/need to replace the bootloader while an app is running on a device? This is a pretty atypical scenario, in my opinion.

thanks,
aditi


> On Nov 11, 2016, at 11:16 AM, David G. Simmons <sa...@mac.com> wrote:
> 
> Interesting side-effect:
> 
> If the blinky app is running, and I attempt to re-load a new version of the bootloader I'm back to:
> 
> DSimmons-Pro:arduino_zero dsimmons$ newt load arduino_boot
> Loading bootloader
> Error: Downloading /Users/dsimmons/dev/arduino_zero/bin/targets/arduino_boot/app/apps/boot/boot.elf.bin to 0x0
> Open On-Chip Debugger 0.9.0 (2015-11-15-05:39)
> Licensed under GNU GPL v2
> For bug reports, read
> 	http://openocd.org/doc/doxygen/bugs.html
> Info : only one transport option; autoselect 'swd'
> adapter speed: 500 kHz
> adapter_nsrst_delay: 100
> cortex_m reset_config sysresetreq
> Info : CMSIS-DAP: SWD  Supported
> Info : CMSIS-DAP: JTAG Supported
> Info : CMSIS-DAP: Interface Initialised (SWD)
> Info : CMSIS-DAP: FW Version = 01.1F.0118
> Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
> Info : CMSIS-DAP: Interface ready
> Info : clock speed 500 kHz
> Info : SWD IDCODE 0x0bc11477
> Info : at91samd21g18.cpu: hardware has 4 breakpoints, 2 watchpoints
> Error: Target not halted
> 
> However, if I then go crash it via the console, then I can load a new bootloader. 
> 
> I don't know if this is significant, but basically with blinky the way it is, you cannot load a new bootloader onto the Arduino Zero Pro without either a) crashing mynewt first or b) erasing the flash. 
> 
> dg
> 
> 
>> On Nov 11, 2016, at 1:53 PM, Christopher Collins <cc...@apache.org> wrote:
>> 
>> Since we are hoping to release soon, I'm inclined to say let's keep
>> blinky how it is for now.  We can figure out the right solution for the
>> next release.  I'm certainly open to hearing opposing viewpoints,
>> though.
> 
> --
> David G. Simmons
> (919) 534-5099
> Web <https://davidgs.com/> • Blog <https://davidgs.com/davidgs_blog> • Linkedin <http://linkedin.com/in/davidgsimmons> • Twitter <http://twitter.com/TechEvangelist1> • GitHub <http://github.com/davidgs>
> /** Message digitally signed for security and authenticity.  
> * If you cannot read the PGP.sig attachment, please go to 
> * http://www.gnupg.com/ <http://www.gnupg.com/> Secure your email!!!
> * Public key available at keyserver.pgp.com <http://keyserver.pgp.com/>
> **/
> ♺ This email uses 100% recycled electrons. Don't blow it by printing!
> 
> There are only 2 hard things in computer science: Cache invalidation, naming things, and off-by-one errors.
> 
> 


Re: OS Event Queue errors in blinky

Posted by "David G. Simmons" <sa...@mac.com>.
Interesting side-effect:

If the blinky app is running, and I attempt to re-load a new version of the bootloader I'm back to:

DSimmons-Pro:arduino_zero dsimmons$ newt load arduino_boot
Loading bootloader
Error: Downloading /Users/dsimmons/dev/arduino_zero/bin/targets/arduino_boot/app/apps/boot/boot.elf.bin to 0x0
Open On-Chip Debugger 0.9.0 (2015-11-15-05:39)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'swd'
adapter speed: 500 kHz
adapter_nsrst_delay: 100
cortex_m reset_config sysresetreq
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: JTAG Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 01.1F.0118
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 500 kHz
Info : SWD IDCODE 0x0bc11477
Info : at91samd21g18.cpu: hardware has 4 breakpoints, 2 watchpoints
Error: Target not halted

However, if I then go crash it via the console, then I can load a new bootloader. 

I don't know if this is significant, but basically with blinky the way it is, you cannot load a new bootloader onto the Arduino Zero Pro without either a) crashing mynewt first or b) erasing the flash. 

dg


> On Nov 11, 2016, at 1:53 PM, Christopher Collins <cc...@apache.org> wrote:
> 
> Since we are hoping to release soon, I'm inclined to say let's keep
> blinky how it is for now.  We can figure out the right solution for the
> next release.  I'm certainly open to hearing opposing viewpoints,
> though.

--
David G. Simmons
(919) 534-5099
Web <https://davidgs.com/> • Blog <https://davidgs.com/davidgs_blog> • Linkedin <http://linkedin.com/in/davidgsimmons> • Twitter <http://twitter.com/TechEvangelist1> • GitHub <http://github.com/davidgs>
/** Message digitally signed for security and authenticity.  
* If you cannot read the PGP.sig attachment, please go to 
 * http://www.gnupg.com/ <http://www.gnupg.com/> Secure your email!!!
 * Public key available at keyserver.pgp.com <http://keyserver.pgp.com/>
**/
♺ This email uses 100% recycled electrons. Don't blow it by printing!

There are only 2 hard things in computer science: Cache invalidation, naming things, and off-by-one errors.



Re: OS Event Queue errors in blinky

Posted by "David G. Simmons" <sa...@mac.com>.
Hi Chris,

Thanks for the insight on this. Yes, that's an interesting side effect. I'm inclined to agree with you that we leave blinky as-is for the release. I'll think about some possible wording for the Tutorials pages around blinky to indicate that it is, indeed, a "hello world" and that we will go into adding, extending, and customizing apps in later tutorials rather than encouraging people to try to do to much with the blinky app itself. 

I have some thoughts on adding packages, etc. to apps as well which I will save for another time. There may be some ways to make newt smarter about package additions based on syscfg.yml contents of an app.

Best regards,
dg

> On Nov 11, 2016, at 1:53 PM, Christopher Collins <cc...@apache.org> wrote:
> 
> Hi David,
> 
> That is an interesting find.  The problem is that blinky does not set a
> default eventq for taskless packages to use.  If a package requires an
> event queue, and none has been designated, it triggers a crash with a
> failed assert.
> 
> Blinky in its original state doesn't crash because it doesn't use any
> packages that require an event queue.  Blinky doesn't actually create an
> event queue at all; its task handler is just a simple blink-and-sleep
> loop.
> 
> I am a bit conflicted about what to do here.  On one hand, blinky is the
> "hello world" of Mynewt, so it is good to keep it as simple as possible.
> Adding event queue processing to its task handler, or an additional
> task, would be at odds with this goal.  On the other hand, blinky is
> also meant to be a playground or sandbox for new users, it should be
> easy to add new packages.
> 
> Since we are hoping to release soon, I'm inclined to say let's keep
> blinky how it is for now.  We can figure out the right solution for the
> next release.  I'm certainly open to hearing opposing viewpoints,
> though.
> 
> Thanks,
> Chris
> 
> On Fri, Nov 11, 2016 at 01:18:07PM -0500, David G. Simmons wrote:
>> I've gotten the blinky app up on the Arduino Zero Pro, and just for fun, I enabled the Console and shell, hooked it up to my FT232H and got ...
>> 
>> 200976:Assert ; failed in os_eventq.c:314
>> 200976:Unhandled interrupt (2), exception sp 0x20007f48
>> 200976: r0:0x00000000  r1:0x00000000  r2:0x80000000  r3:0xe000ed00
>> 200976: r4:0x00000000  r5:0x0000013a  r6:0x00016200  r7:0x00000003
>> 200976: r8:0x000927c0  r9:0x0000ca61 r10:0xbffd8dd3 r11:0xd6beeff1
>> 200976:r12:0xfffff7fe  lr:0x0000d1bd  pc:0x0000d1ca psr:0x8100001b
>> 200976:ICSR:0x0440f002
>> 
>> Now, the blinky app is still running just fine, but from os_eventq.c, line 314:
>> 
>> if (*evq == NULL) {
>>        eventq_dflt = os_eventq_dflt_get();
>>        if (eventq_dflt != NULL) {
>>            os_eventq_designate(evq, eventq_dflt, start_ev);
>>        }
>> 
>>        /* The system is misconfigured if there is still no parent eventq.  The
>>         * application should have explicitly specified a parent queue for each
>>         * package, or indicated a default.
>>         */
>>        assert(*evq != NULL);

--
David G. Simmons
(919) 534-5099
Web <https://davidgs.com/> • Blog <https://davidgs.com/davidgs_blog> • Linkedin <http://linkedin.com/in/davidgsimmons> • Twitter <http://twitter.com/TechEvangelist1> • GitHub <http://github.com/davidgs>
/** Message digitally signed for security and authenticity.  
* If you cannot read the PGP.sig attachment, please go to 
 * http://www.gnupg.com/ <http://www.gnupg.com/> Secure your email!!!
 * Public key available at keyserver.pgp.com <http://keyserver.pgp.com/>
**/
♺ This email uses 100% recycled electrons. Don't blow it by printing!

There are only 2 hard things in computer science: Cache invalidation, naming things, and off-by-one errors.



Re: OS Event Queue errors in blinky

Posted by Christopher Collins <cc...@apache.org>.
Hi David,

That is an interesting find.  The problem is that blinky does not set a
default eventq for taskless packages to use.  If a package requires an
event queue, and none has been designated, it triggers a crash with a
failed assert.

Blinky in its original state doesn't crash because it doesn't use any
packages that require an event queue.  Blinky doesn't actually create an
event queue at all; its task handler is just a simple blink-and-sleep
loop.

I am a bit conflicted about what to do here.  On one hand, blinky is the
"hello world" of Mynewt, so it is good to keep it as simple as possible.
Adding event queue processing to its task handler, or an additional
task, would be at odds with this goal.  On the other hand, blinky is
also meant to be a playground or sandbox for new users, it should be
easy to add new packages.

Since we are hoping to release soon, I'm inclined to say let's keep
blinky how it is for now.  We can figure out the right solution for the
next release.  I'm certainly open to hearing opposing viewpoints,
though.

Thanks,
Chris

On Fri, Nov 11, 2016 at 01:18:07PM -0500, David G. Simmons wrote:
> I've gotten the blinky app up on the Arduino Zero Pro, and just for fun, I enabled the Console and shell, hooked it up to my FT232H and got ...
> 
> 200976:Assert ; failed in os_eventq.c:314
> 200976:Unhandled interrupt (2), exception sp 0x20007f48
> 200976: r0:0x00000000  r1:0x00000000  r2:0x80000000  r3:0xe000ed00
> 200976: r4:0x00000000  r5:0x0000013a  r6:0x00016200  r7:0x00000003
> 200976: r8:0x000927c0  r9:0x0000ca61 r10:0xbffd8dd3 r11:0xd6beeff1
> 200976:r12:0xfffff7fe  lr:0x0000d1bd  pc:0x0000d1ca psr:0x8100001b
> 200976:ICSR:0x0440f002
> 
> Now, the blinky app is still running just fine, but from os_eventq.c, line 314:
> 
> if (*evq == NULL) {
>         eventq_dflt = os_eventq_dflt_get();
>         if (eventq_dflt != NULL) {
>             os_eventq_designate(evq, eventq_dflt, start_ev);
>         }
> 
>         /* The system is misconfigured if there is still no parent eventq.  The
>          * application should have explicitly specified a parent queue for each
>          * package, or indicated a default.
>          */
>         assert(*evq != NULL);
> 
> --
> David G. Simmons
> (919) 534-5099
> Web <https://davidgs.com/> \u2022 Blog <https://davidgs.com/davidgs_blog> \u2022 Linkedin <http://linkedin.com/in/davidgsimmons> \u2022 Twitter <http://twitter.com/TechEvangelist1> \u2022 GitHub <http://github.com/davidgs>
> /** Message digitally signed for security and authenticity.  
> * If you cannot read the PGP.sig attachment, please go to 
>  * http://www.gnupg.com/ <http://www.gnupg.com/> Secure your email!!!
>  * Public key available at keyserver.pgp.com <http://keyserver.pgp.com/>
> **/
> \u267a This email uses 100% recycled electrons. Don't blow it by printing!
> 
> There are only 2 hard things in computer science: Cache invalidation, naming things, and off-by-one errors.
> 
>