PilMCU status

2017-04-02 Thread Alexander Williams
Hello Geo/Alexander,

I discussed this briefly in the chat, but I would like to know the current
status of PilMCU (initial announcement here:
http://www.mail-archive.com/picolisp@software-lab.de/msg04823.html).

It appears some work was released by Alexander within PilOS, and is being
ported back to PilMCU.

In any case, I think this project is very interesting and I would love to
get involved with it.

Geo: Have you chosen an FPGA? Is it "affordable"? Assuming you've gotten it
running on actual hardware, I would be more than willing to pay for a
simple devkit in order to hack on this.

Thanks,


AW


Re: 'native' and pointers to pointers

2017-04-02 Thread Michel Pelletier
Thanks for the explanation Erik!  Sorry I misspelled your name. :)

On Sun, Apr 2, 2017 at 12:11 PM, Erik Gustafson 
wrote:

> Michel,
>
> Here's a link to exactly what you need:
>
> https://github.com/michelp/0pl/blob/master/zmq/zctx.l#L5
>
>
> I totally forgot about 0pl - That's it! Thanks for the quick response.
>
>
> a thread in the archives where Alexander explains it to me...
>
>
> I wasn't able to find it, but here's my attempt:
>
> Passing a pointer reference to 'native' is similar to the integer
> reference example found here: https://software-labde/
> doc/native.html#structArg
> .
>
> It becomes clearer when we think of a reference (a pointer) to a pointer
> instead as a buffer of 8 bytes - sizeof(*ptr) | sizeof(long) - that
> contains a pointer.
>
> We can pass this buffer to 'native' with:
>
>(list NIL (8) (cons Ptr 8))
>
> 'native' then receives something like:
>
>(NIL (8) (35680432 . 8))
>
> In English, I'd read this as "a buffer of 8 bytes - that we won't need to
> reference again (hence NIL) - initialized to contain our pointer, literally
> 'long 35680432' in C."
>
> That's a mouthful. Let's create a naive little helper function so we don't
> have to think about it anymore:
>
>(de  (P) (list NIL (8) (cons P 8)))
>
> A bit more intuitive now:
>
>: (setq *N (native "libzyre.so" "zyre_create" 'N "node"))
>-> 36274819
>: (setq *N (native "libzyre.so" "zyre_destroy" NIL ( *N)))
>-> NIL
>
> Look how nicely '' pairs with the global variable naming convention ;)
> not that I'd ever recommend a global variable for each node on a network...
>
> Corrections/clarifications encouraged!
>
> Cheers,
> Erik
>
>


Re: Building PilBox

2017-04-02 Thread Erik Gustafson
Hi Alex,


> https://developer.android.com/studio/index.html

Yes, I downloaded it from there.


Ok, cool.


 I believe you can just unpack the tar ball and then "import"
it into a new project.


Sounds simple enough, I think my lack of experience with the Android
ecosystem is the culprit here. I'll keep at it.

Thanks,
Erik


Re: Fixed-point scaling and lookup tables

2017-04-02 Thread Dean Gwilliam
>Picolisp's built-in functions for scaled arithmetic are brilliant
That's music to my ears because I've been looking forward to working with
those ever since I started Picolisp for solving systems of equations. Still
working on acquiring the data at the moment but...getting there :),
Thank you for the write-up.

On 1 April 2017 at 22:20, Joh-Tob Schäg  wrote:

> I'll wait.
>
> 2017-04-01 22:45 GMT+02:00 Lindsay John Lawrence <
> lawrence.lindsayj...@gmail.com>:
>
>> My next little picolisp project..
>>
>> Picolisp's built-in functions for scaled arithmetic are brilliant once
>> you understand how they work. Still, it would be great to get more
>> scientific functions without have to link an external math lib, and get
>> 'real-time' performance when needed as well.
>>
>> http://wilsonminesco.com/16bitMathTables/ is a nice write-up (link found
>> on hacker news) of what you can do with fixed point, scaling and lookup
>> tables... Also has links to code to generate the tables.
>>
>> I think the concepts and technique will transfer quite nicely to
>> picolisp.  We'll see...
>>
>> /Lindsay
>>
>>
>


Re: 'native' and pointers to pointers

2017-04-02 Thread Michel Pelletier
Hi Eric,

Here's a link to exactly what you need:

https://github.com/michelp/0pl/blob/master/zmq/zctx.l#L5

There's a thread in the archives where Alexander explains it to me,
unfortunately it's been a while I don't remember all the details myself...

-Michel

On Sun, Apr 2, 2017 at 10:00 AM, Erik Gustafson 
wrote:

> Hi list,
>
> I'm playing with PicoLisp's 'native' functionality and
> https://github.com/zeromq/zyre Most everything works as expected. Trivial
> example:
>
>: (setq Node (native "libzyre.so" "zyre_new" 'N "Node"))
>-> 9322320  # Node set to pointer
>: (native "libzyre.so" "zyre_uuid" 'S Node)
>-> "44536C1E..."  # uuid string
>
> Perfect. The trouble is with 'zyre_destroy'. The C function signature is,
>
>void zyre_destroy (zyre_t **self_p)
>
> In C code it would be called as,
>
>zyre_t *node = zyre_new("node");
>
>zyre_destroy();
>
> How would I do the same in PicoLisp (call 'native' with the equivalent of
> '')? The obviously incorrect,
>
>: (native "libzyre.so" "zyre_destroy" NIL Node)
>
> segfaults. As does,
>
>: (native [...] NIL (struct Node 'N))
>
> and
>
>: (native [...] NIL (car (struct Node '(N
>
> I think I need to do *something* with 'struct', but everything I've tried
> ends with a segfault.
>
> Note: In the Zyre header file the only mention of 'zyre_t' is,
>
>// Opaque class structures to allow forward references
>typedef struct _zyre_t zyre_t;
>
> so I'm not sure how to use 'struct' with it.
>
> Thanks,
> Erik
>


Re: Building PilBox

2017-04-02 Thread Alexander Burger
On Sun, Apr 02, 2017 at 11:09:05AM -0500, Erik Gustafson wrote:
> How are you getting the Android Studio SDK (referred to as '../Sdk/' in the
> README)? I tried getting it from
> 
> https://developer.android.com/studio/index.html

Yes, I downloaded it from there.

I don't remember the exact details, as I did not use it for a while, and then
only used it to develop PentiKeyboard (Java without any native or PicoLisp
parts).

If I recall correctly, I later used the SDK itself to install the NDK via some
menu.


> but it did not have the expected directory structure and I could not find

What is the expected directory structure? Here it simply has one subdirectory
for each project. I believe you can just unpack the tar ball and then "import"
it into a new project.

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


'native' and pointers to pointers

2017-04-02 Thread Erik Gustafson
Hi list,

I'm playing with PicoLisp's 'native' functionality and
https://github.com/zeromq/zyre. Most everything works as expected. Trivial
example:

   : (setq Node (native "libzyre.so" "zyre_new" 'N "Node"))
   -> 9322320  # Node set to pointer
   : (native "libzyre.so" "zyre_uuid" 'S Node)
   -> "44536C1E..."  # uuid string

Perfect. The trouble is with 'zyre_destroy'. The C function signature is,

   void zyre_destroy (zyre_t **self_p)

In C code it would be called as,

   zyre_t *node = zyre_new("node");

   zyre_destroy();

How would I do the same in PicoLisp (call 'native' with the equivalent of
'')? The obviously incorrect,

   : (native "libzyre.so" "zyre_destroy" NIL Node)

segfaults. As does,

   : (native [...] NIL (struct Node 'N))

and

   : (native [...] NIL (car (struct Node '(N

I think I need to do *something* with 'struct', but everything I've tried
ends with a segfault.

Note: In the Zyre header file the only mention of 'zyre_t' is,

   // Opaque class structures to allow forward references
   typedef struct _zyre_t zyre_t;

so I'm not sure how to use 'struct' with it.

Thanks,
Erik


Re: Building PilBox

2017-04-02 Thread Erik Gustafson
Hmm...

How are you getting the Android Studio SDK (referred to as '../Sdk/' in the
README)? I tried getting it from

https://developer.android.com/studio/index.html

but it did not have the expected directory structure and I could not find
'make_standalone_toolchain.py'. I also tried using the Android Studio IDE
and various arch linux packages, but none seemed to produce the expected
directory structure.

Instead I grabbed the Android NDK from

https://developer.android.com/ndk/downloads/index.html

which includes 'build/tools/make_standalone_toolchain.py'.

Using that to build the toolchain into 'PilBox/' seems to work fine, as all
the files needed for 'mk.arm64.linux' are in the right places. Then, at
some point during the build ('./mk.arm64.linux') process,
'toolchain/bin/clang38' is executed (presumably from
'toolchain/bin/aarch64-linux-android-clang'?). And 'clang38' expects
ncurses? I'm just as confused as you here.

I'm guessing the problem is that I'm using the NDK instead? Probably should
have mentioned that in my first mail...

Erik

On Apr 2, 2017 8:10 AM, "Alexander Burger"  wrote:

He Erik,

> preparing the toolchain, but './mk.arm64.linux' fails with the following
> (abridged) error messages:
>
>../../toolchain/bin/clang38: error while loading shared libraries:
> libncurses.so.5: no such file

This makes absolutely no sense to me. Ncurses should not be needed anywhere
to
build the binary.

Can you find out more about the context?

♪♫ Alex
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Building PilBox

2017-04-02 Thread Alexander Burger
He Erik,

> preparing the toolchain, but './mk.arm64.linux' fails with the following
> (abridged) error messages:
> 
>../../toolchain/bin/clang38: error while loading shared libraries:
> libncurses.so.5: no such file

This makes absolutely no sense to me. Ncurses should not be needed anywhere to
build the binary.

Can you find out more about the context?

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe