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


Groups > linux.debian.user > #197857 > unrolled thread

Arduino and Python or gcc compiler?

Started bycyaiplexys <cyaiplexys@sitesplace.net>
First post2018-07-22 00:40 +0200
Last post2018-07-22 09:40 +0200
Articles 9 — 5 participants

Back to article view | Back to linux.debian.user


Contents

  Arduino and Python or gcc compiler? cyaiplexys <cyaiplexys@sitesplace.net> - 2018-07-22 00:40 +0200
    Re: Arduino and Python or gcc compiler? deloptes <deloptes@gmail.com> - 2018-07-22 01:40 +0200
      Re: Arduino and Python or gcc compiler? cyaiplexys <cyaiplexys@sitesplace.net> - 2018-07-22 04:10 +0200
        Re: Arduino and Python or gcc compiler? deloptes <deloptes@gmail.com> - 2018-07-22 12:30 +0200
          Re: Arduino and Python or gcc compiler? cyaiplexys <cyaiplexys@sitesplace.net> - 2018-07-22 16:50 +0200
        Re: Arduino and Python or gcc compiler? Cindy-Sue Causey <butterflybytes@gmail.com> - 2018-07-22 18:50 +0200
    Re: Arduino and Python or gcc compiler? David Christensen <dpchrist@holgerdanske.com> - 2018-07-22 03:10 +0200
      Re: Arduino and Python or gcc compiler? cyaiplexys <cyaiplexys@sitesplace.net> - 2018-07-22 04:20 +0200
    Re: Arduino and Python or gcc compiler? Joe <joe@jretrading.com> - 2018-07-22 09:40 +0200

#197857 — Arduino and Python or gcc compiler?

Fromcyaiplexys <cyaiplexys@sitesplace.net>
Date2018-07-22 00:40 +0200
SubjectArduino and Python or gcc compiler?
Message-ID<we8HE-14o-7@gated-at.bofh.it>
I am getting the Elegoo Super Starter Kit (Arduino Uno R3) to tinker 
with (it's on order as of when I'm writing this post).

I looked in the Debian repos for stuff on Arduino and didn't find much 
(at least not of interest to me).

I did download the IDE from Elegoo and their tutorials and libraries. 
But it's all in C/C++. While I do know C and C++ (to some extent), I'm 
very bad at it (I admit to not using it very much, maybe once every 
other blue moon and lately we haven't had any blue moons that warranted 
using C).

I recently been doing stuff in Python (especially for work, which is not 
Arduino related in any way). I am really getting to like Python. I have 
created my own Python Libraries for other things (again unrelated) and 
even compiled them to .so (binary) using the 'cython' compiler.

While I could create C source of a Python script using cython, I don't 
know how to compile the resulting C source and upload it to the Arduino 
board. I would like to use gcc.

Is there a cross-platform compiler for Arduino and gcc that anyone has 
had experience with that works or they can recommend?

Or some way to program in Python?

I'll use C/C++ until I can figure the Python stuff out. But I really 
would like to be able to use Python at some point.

[toc] | [next] | [standalone]


#197859

Fromdeloptes <deloptes@gmail.com>
Date2018-07-22 01:40 +0200
Message-ID<we9DI-1Hw-3@gated-at.bofh.it>
In reply to#197857
Hi, how old are you?
The way you wrote is supposing you are New Gen kid.
Anyway few answers inline

cyaiplexys wrote:

> I am getting the Elegoo Super Starter Kit (Arduino Uno R3) to tinker
> with (it's on order as of when I'm writing this post).
> 
> I looked in the Debian repos for stuff on Arduino and didn't find much
> (at least not of interest to me).
> 

What did you expect to find exactly?

> I did download the IDE from Elegoo and their tutorials and libraries.
> But it's all in C/C++. While I do know C and C++ (to some extent), I'm
> very bad at it (I admit to not using it very much, maybe once every
> other blue moon and lately we haven't had any blue moons that warranted
> using C).
> 

Well for low level programming mostly C is used actually.
New things to learn -> write a list with dependencies and priorities.

> I recently been doing stuff in Python (especially for work, which is not
> Arduino related in any way). I am really getting to like Python. I have
> created my own Python Libraries for other things (again unrelated) and
> even compiled them to .so (binary) using the 'cython' compiler.
> 

More to learn -> add to the list

> While I could create C source of a Python script using cython, I don't
> know how to compile the resulting C source and upload it to the Arduino
> board. I would like to use gcc.
> 
More to learn -> add to the list

> Is there a cross-platform compiler for Arduino and gcc that anyone has
> had experience with that works or they can recommend?
> 
More to learn -> add to the list
I did not have a look at Arduino but played with AVR chip programming, so
sure there is for Arduino as well.

> Or some way to program in Python?
> 
> I'll use C/C++ until I can figure the Python stuff out. But I really
> would like to be able to use Python at some point.

Finally you are on the wrong user list. This is general debian user list and
we discuss only debian related questions.
IMO Arduino and related should be somewhere else.

regards

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


#197864

Fromcyaiplexys <cyaiplexys@sitesplace.net>
Date2018-07-22 04:10 +0200
Message-ID<webYS-3fi-5@gated-at.bofh.it>
In reply to#197859
On 07/21/2018 07:36 PM, deloptes wrote:
> Hi, how old are you?
> The way you wrote is supposing you are New Gen kid.

Why thank you! :) Actually, physically I'm over half a century old. I 
just try to keep a young mind. I'm a New Gen kid to all this new tech 
stuff though.

> Anyway few answers inline
> 
> cyaiplexys wrote:
> 
>> I am getting the Elegoo Super Starter Kit (Arduino Uno R3) to tinker
>> with (it's on order as of when I'm writing this post).
>>
>> I looked in the Debian repos for stuff on Arduino and didn't find much
>> (at least not of interest to me).
>>
> 
> What did you expect to find exactly?

*gulp* Python libraries? Cython compiler for the Arduino CPU?

When I wrote this I didn't know exactly what I'm getting into. I heard 
of Arduino and had the impression it's an ARM or ARM-type processor on a 
board and you can interact with your electronic circuits you build with 
it and a computer. After writing the post I went and looked up some 
YouTube tutorials for beginners. I probably should have done that first 
before inserting foot in mouth. :-/

>> I did download the IDE from Elegoo and their tutorials and libraries.
>> But it's all in C/C++. While I do know C and C++ (to some extent), I'm
>> very bad at it (I admit to not using it very much, maybe once every
>> other blue moon and lately we haven't had any blue moons that warranted
>> using C).
>>
> 
> Well for low level programming mostly C is used actually.
> New things to learn -> write a list with dependencies and priorities.
:
> More to learn -> add to the list
> I did not have a look at Arduino but played with AVR chip programming, so
> sure there is for Arduino as well.

I'll remain hopeful. I'm going to have a long list of things I'll want 
to learn.

>> Or some way to program in Python?
>>
>> I'll use C/C++ until I can figure the Python stuff out. But I really
>> would like to be able to use Python at some point.
> 
> Finally you are on the wrong user list. This is general debian user list and
> we discuss only debian related questions.
> IMO Arduino and related should be somewhere else.

Well, since I use Debian I assumed this would be a place to ask what to 
get from the Debian repo that would help in achieving my goal. But you 
do make a good point. I'll have to find some Arduino forums to ask some 
questions in because I'm quite sure I'll have a lot of them.

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


#197875

Fromdeloptes <deloptes@gmail.com>
Date2018-07-22 12:30 +0200
Message-ID<wejMJ-8qa-1@gated-at.bofh.it>
In reply to#197864
cyaiplexys wrote:

> Well, since I use Debian I assumed this would be a place to ask what to
> get from the Debian repo that would help in achieving my goal. But you
> do make a good point. I'll have to find some Arduino forums to ask some
> questions in because I'm quite sure I'll have a lot of them.

Sure Arduino forums will be useful when you have specific Arduino questions.
Related to debian you have this page
https://wiki.debian.org/Arduino
It looks like it gives you the connection to the arduino board /dev/ttyACM0.

Next CPUs - IMO you definitely need to know for which CPU you develop code
https://www.arduino.cc/en/Products/Compare
but it could be that the IDE hides this.

Salt it with some background knowledge
https://www.arduino.cc/en/Tutorial/Foundations

It is not a one day exercise, but it may be fun.

I did AVR for a hobby. I bought few types of AVR chips a dev board, that I
had to soldier myself and a programmer (total cost ~ €25,-). It took me
some time to understand how the programmer is to be used with the board and
how it is intended to work on linux. I guess it was two weekends that I
spent reading and trying. Finally Enlightment was there and voila, I can
write, compile, flash and run the MCs. Altogether it spanned over 8 months
because of job and family. I think the total time spent was about 1 month
though.
So it depends on your level and skill. It might take months or hours, but at
the end you will be an expert.
It might be also worth learning some C. I am not sure how python compiles
low level code, but I guess it comes with overhead. Given the amount of
memory available, it might be wise to keep low footprint. Also you do not
need to know a lot of details. Focus is on bitwise operations that are used
when working with bits. But there are very good examples, so if you have an
understanding of the concept of C language, it shouldn't be a big
challenge.

good luck

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


#197891

Fromcyaiplexys <cyaiplexys@sitesplace.net>
Date2018-07-22 16:50 +0200
Message-ID<wenQm-2D4-11@gated-at.bofh.it>
In reply to#197875
On 07/22/2018 06:20 AM, deloptes wrote:
> cyaiplexys wrote:
> 
>> Well, since I use Debian I assumed this would be a place to ask what to
>> get from the Debian repo that would help in achieving my goal. But you
>> do make a good point. I'll have to find some Arduino forums to ask some
>> questions in because I'm quite sure I'll have a lot of them.
> 
> Sure Arduino forums will be useful when you have specific Arduino questions.
> Related to debian you have this page
> https://wiki.debian.org/Arduino
> It looks like it gives you the connection to the arduino board /dev/ttyACM0.
> 
> Next CPUs - IMO you definitely need to know for which CPU you develop code
> https://www.arduino.cc/en/Products/Compare
> but it could be that the IDE hides this.
> 
> Salt it with some background knowledge
> https://www.arduino.cc/en/Tutorial/Foundations
> 
> It is not a one day exercise, but it may be fun.
 >
> I did AVR for a hobby. I bought few types of AVR chips a dev board, that I
> had to soldier myself and a programmer (total cost ~ €25,-). It took me
> some time to understand how the programmer is to be used with the board and
> how it is intended to work on linux. I guess it was two weekends that I
> spent reading and trying. Finally Enlightment was there and voila, I can
> write, compile, flash and run the MCs. Altogether it spanned over 8 months
> because of job and family. I think the total time spent was about 1 month
> though.
> So it depends on your level and skill. It might take months or hours, but at
> the end you will be an expert.

When I get into these things, it might take me a few months to maybe 
even years to learn something new fully. And some things only take a 
weekend. Depends on what skills one needs to get going with it. I have 
35+ years programming experience in many different languages, and 
tinkered in electronics even as young as age 7. But the thing is, while 
I learned the basics (and when Google came around, Googled for stuff I 
didn't know that I needed to apply to a project), and even took a couple 
online courses in programming, I find it's a matter of use it or lose 
it. If I don't use it regularly (like I do with PHP, HTML, CSS, Perl, 
and Python in my job), then I tend to forget almost all I learned and 
kinda end up Googling for help with everything or looking up my code 
snippets and notes.

But at the same time, I enjoy tinkering with stuff, even if I might 
forget a year or two later. For my own hobbies, I just get curious about 
some of the "new" (I know this stuff has been around awhile) technology 
out there and like to see how it all works.

> It might be also worth learning some C. 

I had done some C programming now and then (K & R C, ANSI C, Mix Power 
C, Borland C++, gcc, Visual C) and now anytime I do anything in C, I use 
gcc (and also valgrind, autotools, and I forgot what else I use but I 
use Kate for my editor for nearly everything and compile at command 
line). I still struggle with C because I don't use it much. However, I 
use a lot of stuff that has a similar structure to C such as perl and 
PHP. Funny thing is, I also learned Java but almost never use it!

> I am not sure how python compiles low level code, but I guess it
 > comes with overhead.

Python is a scripting language so natively it doesn't get compiled, 
really. To compile Python code to binary .so for like Python libraries 
(which is NOT required but there are some uses for doing so), I use a 
program called 'cython' (in the debian repos) that converts Python code 
to C code, then uses gcc to compile the resulting C code. Does a decent 
job of it for what I was doing.

 > Given the amount of memory available, it might be wise to keep low
 > footprint. Also you do not need to know a lot of details. Focus is on
 > bitwise operations that are used when working with bits.

I actually haven't done much of that in *years* - since my OS9-Level II 
days. Got to brush up on that now.

 > But there are very good examples, so if you have an understanding of
 > the concept of C language, it shouldn't be a big challenge.
 >
 > good luck

Good to know. And thank you for all the really good information. I'm 
saving it for my "list to learn".

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


#197908

FromCindy-Sue Causey <butterflybytes@gmail.com>
Date2018-07-22 18:50 +0200
Message-ID<wepIu-3TB-13@gated-at.bofh.it>
In reply to#197864
On 7/21/18, cyaiplexys <cyaiplexys@sitesplace.net> wrote:
> On 07/21/2018 07:36 PM, deloptes wrote:
>> Hi, how old are you?
>> The way you wrote is supposing you are New Gen kid.
>
> Why thank you! :) Actually, physically I'm over half a century old. I
> just try to keep a young mind. I'm a New Gen kid to all this new tech
> stuff though.


The word "tinker" was the tell I picked up on there. As it turns out,
that was right on the money. :D

Cindy :)
-- 
Cindy-Sue Causey
Talking Rock, Pickens County, Georgia, USA

* runs with duct tape *

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


#197860

FromDavid Christensen <dpchrist@holgerdanske.com>
Date2018-07-22 03:10 +0200
Message-ID<web2O-2Fm-15@gated-at.bofh.it>
In reply to#197857
On 07/21/18 15:15, cyaiplexys wrote:
> I am getting the Elegoo Super Starter Kit (Arduino Uno R3) to tinker 
> with (it's on order as of when I'm writing this post).
> 
> I looked in the Debian repos for stuff on Arduino and didn't find much 
> (at least not of interest to me).
> 
> I did download the IDE from Elegoo and their tutorials and libraries. 
> But it's all in C/C++. While I do know C and C++ (to some extent), I'm 
> very bad at it (I admit to not using it very much, maybe once every 
> other blue moon and lately we haven't had any blue moons that warranted 
> using C).
> 
> I recently been doing stuff in Python (especially for work, which is not 
> Arduino related in any way). I am really getting to like Python. I have 
> created my own Python Libraries for other things (again unrelated) and 
> even compiled them to .so (binary) using the 'cython' compiler.
> 
> While I could create C source of a Python script using cython, I don't 
> know how to compile the resulting C source and upload it to the Arduino 
> board. I would like to use gcc.
> 
> Is there a cross-platform compiler for Arduino and gcc that anyone has 
> had experience with that works or they can recommend?
> 
> Or some way to program in Python?
> 
> I'll use C/C++ until I can figure the Python stuff out. But I really 
> would like to be able to use Python at some point.

It sounds like your intended use is as a hobbyist (?).


STFW for Arduino Uno R3:

https://store.arduino.cc/arduino-uno-rev3

Microcontroller 	ATmega328P

Flash Memory 	32 KB (ATmega328P) of which 0.5 KB used by bootloader

SRAM 	2 KB (ATmega328P)

EEPROM 	1 KB (ATmega328P)

Clock Speed 	16 MHz


STFW for the CPU:

http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_Datasheet.pdf

The Atmel® picoPower® ATmega328/P is a low-power CMOS 8-bit
microcontroller based on the AVR® enhanced RISC architecture.


STFW for embedded Python:

https://www.usenix.org/system/files/conference/atc12/atc12-final30.pdf

This  paper  presents  one  mechanism  for  doing  so:
an  efficient  embedded  Python  run-time  system  named
Owl. The Owl system is a complete Python development
toolchain and run-time system for microcontrollers that
do not have enough resources to run a real operating sys-
tem, but are still capable of running sophisticated soft-
ware systems.  These microcontrollers typically operate
at 50–100 MHz, have 64–128 KB of SRAM, and have
up  to  512  KB  of  on-chip  flash.


Note that the frequency, RAM, and ROM requirements for embedded Python 
exceed what is provided by the Arduino Uno.  So, that explains why I 
also find no solutions for Python on the Arduino Uno R3.


If you want an embedded kit that can do Python (2 or 3?), your best bet 
is to get a kit that supports Python OOTB:

https://wiki.python.org/moin/EmbeddedPython


Getting a kit that supports Linux OOTB would give you even more options:

https://www.linux.com/news/top-10-open-source-linux-boards-under-200


David

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


#197865

Fromcyaiplexys <cyaiplexys@sitesplace.net>
Date2018-07-22 04:20 +0200
Message-ID<wec8x-3oG-3@gated-at.bofh.it>
In reply to#197860
On 07/21/2018 09:01 PM, David Christensen wrote:
> On 07/21/18 15:15, cyaiplexys wrote:
>> I am getting the Elegoo Super Starter Kit (Arduino Uno R3) to tinker 
>> with (it's on order as of when I'm writing this post).
>>
>> I looked in the Debian repos for stuff on Arduino and didn't find much 
>> (at least not of interest to me).
>>
>> I did download the IDE from Elegoo and their tutorials and libraries. 
>> But it's all in C/C++. While I do know C and C++ (to some extent), I'm 
>> very bad at it (I admit to not using it very much, maybe once every 
>> other blue moon and lately we haven't had any blue moons that 
>> warranted using C).
>>
>> I recently been doing stuff in Python (especially for work, which is 
>> not Arduino related in any way). I am really getting to like Python. I 
>> have created my own Python Libraries for other things (again 
>> unrelated) and even compiled them to .so (binary) using the 'cython' 
>> compiler.
>>
>> While I could create C source of a Python script using cython, I don't 
>> know how to compile the resulting C source and upload it to the 
>> Arduino board. I would like to use gcc.
>>
>> Is there a cross-platform compiler for Arduino and gcc that anyone has 
>> had experience with that works or they can recommend?
>>
>> Or some way to program in Python?
>>
>> I'll use C/C++ until I can figure the Python stuff out. But I really 
>> would like to be able to use Python at some point.
> 
> It sounds like your intended use is as a hobbyist (?).

Yes. I heard about it and got curious. I liked tinkering with 
electronics back in the day and kinda wondered what this is about. It's 
just basically for my own fun. I don't expect to make something the 
world can't live without or anything like that.

> STFW for Arduino Uno R3: >
> https://store.arduino.cc/arduino-uno-rev3
> 
> Microcontroller     ATmega328P
> 
> Flash Memory     32 KB (ATmega328P) of which 0.5 KB used by bootloader
> 
> SRAM     2 KB (ATmega328P)
> 
> EEPROM     1 KB (ATmega328P)
> 
> Clock Speed     16 MHz

> STFW for the CPU:
> 
> http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_Datasheet.pdf 
> 
> 
> The Atmel® picoPower® ATmega328/P is a low-power CMOS 8-bit
> microcontroller based on the AVR® enhanced RISC architecture.
> 
> STFW for embedded Python:
> 
> https://www.usenix.org/system/files/conference/atc12/atc12-final30.pdf
> 
> This  paper  presents  one  mechanism  for  doing  so:
> an  efficient  embedded  Python  run-time  system  named
> Owl. The Owl system is a complete Python development
> toolchain and run-time system for microcontrollers that
> do not have enough resources to run a real operating sys-
> tem, but are still capable of running sophisticated soft-
> ware systems.  These microcontrollers typically operate
> at 50–100 MHz, have 64–128 KB of SRAM, and have
> up  to  512  KB  of  on-chip  flash.
> 
> 
> Note that the frequency, RAM, and ROM requirements for embedded Python 
> exceed what is provided by the Arduino Uno.  So, that explains why I 
> also find no solutions for Python on the Arduino Uno R3.
> 
> 
> If you want an embedded kit that can do Python (2 or 3?), your best bet 
> is to get a kit that supports Python OOTB:
> 
> https://wiki.python.org/moin/EmbeddedPython
> 
> 
> Getting a kit that supports Linux OOTB would give you even more options:
> 
> https://www.linux.com/news/top-10-open-source-linux-boards-under-200

Lots of info there. Well, glad it's possible. Looks like it'll take some 
doing though. Obviously there won't be anything in Debian's Repo for it 
like I hoped.

Thank you for giving me some ideas on what to look for. That'll keep me 
busy for awhile!

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


#197872

FromJoe <joe@jretrading.com>
Date2018-07-22 09:40 +0200
Message-ID<weh8d-6Dj-1@gated-at.bofh.it>
In reply to#197857
On Sat, 21 Jul 2018 18:15:12 -0400
cyaiplexys <cyaiplexys@sitesplace.net> wrote:

> I am getting the Elegoo Super Starter Kit (Arduino Uno R3) to tinker 
> with (it's on order as of when I'm writing this post).
> 
> I looked in the Debian repos for stuff on Arduino and didn't find
> much (at least not of interest to me).
> 
> I did download the IDE from Elegoo and their tutorials and libraries. 
> But it's all in C/C++. While I do know C and C++ (to some extent),
> I'm very bad at it (I admit to not using it very much, maybe once
> every other blue moon and lately we haven't had any blue moons that
> warranted using C).
> 
> I recently been doing stuff in Python (especially for work, which is
> not Arduino related in any way). I am really getting to like Python.
> I have created my own Python Libraries for other things (again
> unrelated) and even compiled them to .so (binary) using the 'cython'
> compiler.
> 
> While I could create C source of a Python script using cython, I
> don't know how to compile the resulting C source and upload it to the
> Arduino board. I would like to use gcc.
> 
> Is there a cross-platform compiler for Arduino and gcc that anyone
> has had experience with that works or they can recommend?
> 
> Or some way to program in Python?
> 


Sure if I was going there I wouldn't be after starting from here...

I've seen your later post, and you may indeed be overestimating what
the Arduino can do, it's basically a very well developed ecosystem for
a microcontroller, with lots of real-world interfaces available. Just
for tinkering with electronics, it's fine.

If you're after a more powerful (i.e. PC-like) tinkering gadget, you
might be better looking at the Raspberry Pi (Pi for Python) and the
subsequent similar devices. More expensive than the Arduino, but still
pretty cheap. The Pi runs more than one OS, but the Raspbian version of
Debian is probably most widely-used. The Pi also has a great many
interface devices available, and Python is the expected scripting
language.

-- 
Joe

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web