Re: [Amforth] "multi", "multitaskpause" hang system

2018-03-21 Thread Tristan Williams
Hello Frank,

I am sitting looking at some multitasking flashing LEDs, but you just
beat me to it :) It does indeed live.

I still find it amazing to have a multitasking environment and an
interactive interpreter/compiler on an mcu you can setup on a
breadboard. Makes me smile.

Best wishes,
Tristan

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel


Re: [Amforth] "multi", "multitaskpause" hang system

2018-03-21 Thread Frank Z via Amforth-devel
Hey everyone,

So I decided to dump out all my code and begin with the barest minimum (a 
freshly programmed device) to see if I’d get multitasking and I can confirm: 
she lives!

**
 ok
> hex init starttasker
 ok
> tasks
17B   running
1A9   running
Multitasker is running ok
> single
 ok
> multi
 ok
>
**

And the LED blinks. 

So something else in my other code that’s been working just fine alone is 
obviously not playing ball in the multitasking leagues.

From here I’ll progressively add my other code until it breaks and I’ll figure 
it out from there. Thanks for your time and attention.

Regards,
Frank

> On Mar 21, 2018, at 6:13 PM, Frank Z  wrote:
> 
> Hey Erich,
> 
> Thanks for the welcome and good suggestion.
> 
> I had actually tried $40 $40 $10 before - no luck.
> 
> So just now I tried $80 $80 $20 - no luck. 
> 
> I’ll think a bit about it…will try $100 $100 $80 and see…..just did: no dice.
> 
> So I’m not entirely sure it is a space (data stack, return stack, additional 
> user area) issue.
> 
> Regards,
> Frank
> 
>> On Mar 21, 2018, at 4:30 PM, Erich Wälde  wrote:
>> 
>> 
>> Hello Frank,
>> 
>> welcome on the list!
>> 
>> Eye ball inspection and comparing to a project of mine and
>> mulittask-test.frt did not show a problem to me, however
>> 
>> instead of
>> 
>>> $20 $20 $10 task: task_demo
>> 
>> try
>> 
>>> $40 $40 $10 task: task_demo
>> 
>> just in bloody case. Allthough 16 cells sound like a lot, its
>> maybe a little short ... this is just guessing.
>> 
>> 
>> Good luck!
>> Erich
> 


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel


Re: [Amforth] "multi", "multitaskpause" hang system

2018-03-21 Thread Frank Z via Amforth-devel
Hey Erich,

Thanks for the welcome and good suggestion.

I had actually tried $40 $40 $10 before - no luck.

So just now I tried $80 $80 $20 - no luck. 

I’ll think a bit about it…will try $100 $100 $80 and see…..just did: no dice.

So I’m not entirely sure it is a space (data stack, return stack, additional 
user area) issue.

Regards,
Frank

> On Mar 21, 2018, at 4:30 PM, Erich Wälde  wrote:
> 
> 
> Hello Frank,
> 
> welcome on the list!
> 
> Eye ball inspection and comparing to a project of mine and
> mulittask-test.frt did not show a problem to me, however
> 
> instead of
> 
>> $20 $20 $10 task: task_demo
> 
> try
> 
>> $40 $40 $10 task: task_demo
> 
> just in bloody case. Allthough 16 cells sound like a lot, its
> maybe a little short ... this is just guessing.
> 
> 
> Good luck!
> Erich


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel


Re: [Amforth] "multi", "multitaskpause" hang system

2018-03-21 Thread Erich Wälde

Hello Frank,

welcome on the list!

Eye ball inspection and comparing to a project of mine and
mulittask-test.frt did not show a problem to me, however

instead of

> $20 $20 $10 task: task_demo

try

> $40 $40 $10 task: task_demo

just in bloody case. Allthough 16 cells sound like a lot, its
maybe a little short ... this is just guessing.


Good luck!
Erich

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel


[Amforth] "multi", "multitaskpause" hang system

2018-03-21 Thread Frank Z via Amforth-devel
Hi everyone,

First time positing and just wanted to compliment Matthias and the team on the 
good work on amforth.

Now onto my main issue...

I’ve recently run into amforth and have so far had a good experience with it 
and getting it to work with LEDs and some spi devices.

Recently, I thought I might try out multitasking but ran into some issues; 
“multi” hangs my system.

HW: I’m running it on an ATmega328 processor (in DIP format on a breadboard).

I have a simple program to initialize the PB1 pin (on which I have an LED) as 
an output and to toggle its voltage output level. This is known to work without 
multitasking.

The amforth-6.4/common/lib/multitask-test.frt file was the template from which 
I worked. The “multitask.frt” file has already been loaded.
Here’s the file I send to the microcontroller via amforth-upload.py:
**
testA1
marker testA1

: ms ( n -- ) 0 ?do pause 1ms loop ; \ call pause on wait
;

: init
led0_gpio_init 
;

: run-demo
begin
led0_toggle
#500 ms
again
;

$20 $20 $10 task: task_demo

: start-demo
task_demo tib>tcb activate
\ words after this line are run in the new task
run-demo
;

: starttasker
task_demo task-init
start-demo
onlytask
task_demo tib>tcb alsotask
multi
;

: run-turnkey
applturnkey
init
starttasker
;
**

System hanged in “starttasker”. Upon closer inspection I found the hang in 
“multi”.

A quick run of “ task_demo task-init start-demo onlytask task_demo tib>tcb 
alsotask ” at the prompt, 
followed by “tasks" gives the following which suggests the tasks are properly 
setup at 0x17B and 0x1AB.

**
 ok 
> amforth 6.4 ATmega328P   
> hex   
 ok 
> tasks 
17B   unknown   
> task_demo task-init start-demo onlytask task_demo tib>tcb alsotask
 ok 
> tasks 
17B   running   
1AB   running   
Multitasker is not running ok   
> single
 ok 
> tasks 
17B   running   
1AB   running   
Multitasker is not running ok   
> 
**
If I execute "multi” at this point, the system just hangs and only recovers 
with a manual reset.

I find it interesting that “single” executes fine but “multi” hangs given that 
they look quite similar:

: single ( -- )
['] noop ['] pause defer!
;

: multi ( -- )
['] multitaskpause ['] pause defer!
;

It may hint that something may be amiss in “multitaskpause”. Mine looks like 
this:
: multitaskpause   ( -- ) rp@ sp@ sp ! follower @ dup @ i-cell+ >r ;

If you have any pointers on how to solve this, I’d be grateful if you’d share.

Regards,
Frank




--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel