Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
Compiling for Arduino 328 target

 
Post new topic   Reply to topic    Forum Index -> ZBasic IDE
Author Message
spamiam



Joined: 13 Nov 2005
Posts: 739

Posted: 25 September 2017, 11:29 AM    Post subject: Compiling for Arduino 328 target Reply with quote

I see that the newest IDE/Compiler seems to have the ability to compile for an arduino target. I have some Nano clones that I might be able to use.

I selected the ZA-328 as the target for the compiler. When I compiled my pre-existing code (used for a generic ATMeg-328P, 16 MHz), I received the following error message:

Internal error: device.cpp(3118), Rev $Rev: unexpected pin table entry

What did I do wrong? As far as I know, I do not refer to Arduino pins, instead I refer to CPU ports and bits (e.g. C.4).

To run some ZBasic code on an arduino, do I need to install a ZBasic bootloader on it (does this turn it into a "generic" ZBasic device, or maybe "Native"?) or can it use the Arduino Optiboot?

-Tony
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2991
Location: Portland, OR

Posted: 25 September 2017, 14:44 PM    Post subject: Re: Compiling for Arduino 328 target Reply with quote

spamiam wrote:
What did I do wrong? As far as I know, I do not refer to Arduino pins, instead I refer to CPU ports and bits (e.g. C.4).
That is difficult to say without looking at your code. If you'll send it to me so that I can compile the project I can determine what is happening.

spamiam wrote:
To run some ZBasic code on an arduino, do I need to install a ZBasic bootloader on it [...]?
You will need the ZBasic bootloader and you can build one using the files on the zboot directory. Essentially, the Arduino device targets are standardized generic target devices for which the special license is not required (similar to the ESP8266 in that regard).
Back to top
spamiam



Joined: 13 Nov 2005
Posts: 739

Posted: 25 September 2017, 14:57 PM    Post subject: Reply with quote

Thanks Don,

I will send you the source code for you to try.

My ZBasic installation is a fresh brand new installation on a Win10 laptop. I originally developed the program on my Win7 desktop running an OLD version of the compiler and IDE. I have been compiling there using the generic 328P as the target.

The target has a Zbasic bootloader and runs at 16MHz (with a resonator), but it is otherwise a pretty standard platform for ZBasic and Arduino.

What would be the proper target for an Arduino Nano (ATMega328) modified with the ZBasic bootloader?

Also, once I install the ZBasic bootloader, then it will not follow the Arduino Optiboot download protocol. I see mention being made of the ability to tell the IDE to use arduino protocol for download? Is that correct? If so, under what circumstances would that happen?

-Tony
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2991
Location: Portland, OR

Posted: 25 September 2017, 16:05 PM    Post subject: Reply with quote

spamiam wrote:
What would be the proper target for an Arduino Nano (ATMega328) modified with the ZBasic bootloader?
As long as it is a standard 16MHz mega328P-based Arduino you would use ZA-328 as the target.

spamiam wrote:
I see mention being made of the ability to tell the IDE to use arduino protocol for download?
Where did you see that?
Back to top
spamiam



Joined: 13 Nov 2005
Posts: 739

Posted: 25 September 2017, 16:19 PM    Post subject: Reply with quote

Hmmmm... Good Question!

I thought it was in one of the manuals for ZBasic. But I don't see it now. As I recall, it was a chart showing a few ATMega processors in one column and then another column listing Optiboot, and maybe another bootloader as some sort of option for that CPU.

But the chart did not make immediate sense to me as to how that would relate to compiling and loading the program to a CPU. I will have to check on this further to see what in the world I was possibly seeing and thinking!

-Tony
Back to top
spamiam



Joined: 13 Nov 2005
Posts: 739

Posted: 26 September 2017, 1:46 AM    Post subject: Reply with quote

Don,
By the way, I see the ZA-328 as a listed target. i was assuming that the "A" in the name means Arduino. But I do not see any info on the "ZA" devices in the reference manuals. Did I miss it?

Is it choosing the ZA-328 as the target that will create "generic" type code without requiring a "generic" mode license, whereas compiling for the ATMega328P WILL require the generic license?

Other than potentially not requiring a generic license, what is the functional difference between compiling for the ZA-328 and the ATMega328?

-Tony
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2991
Location: Portland, OR

Posted: 26 September 2017, 1:59 AM    Post subject: Reply with quote

spamiam wrote:
i was assuming that the "A" in the name means Arduino.
You assumed correctly. The support was added due to the widespread use of the Arduino devices and in preparation for a particular third party application that did not proceed. It was left in but not documented.

spamiam wrote:
Is it choosing the ZA-328 as the target that will create "generic" type code without requiring a "generic" mode license, whereas compiling for the ATMega328P WILL require the generic license?
Yes, but of course the Arduino devices are a specific generic target (e.g. processor speed, etc.). One could compile an application for the ZA-328 and run the code on a hardware platform of their own design as long as the pertinent parameters match the Arduino devices.
Back to top
spamiam



Joined: 13 Nov 2005
Posts: 739

Posted: 26 September 2017, 2:12 AM    Post subject: Reply with quote

Ah, a stillborn third party device. That explains the undocumented target!

So, it assumes 16Mhz on the CPU. What are the RTC settings and other parameters it will use? Would it be what I would generate in the "Target options" window?

E.G. ZBasic bootloader, MLF-32, 16MHZ, RTC enabled, 500 Hz RTC feq?

BTW, I found the page that confused me a little about the IDE possibly being able to boot load to an Arduino:

http://www.zbasic.net/Arduino-Devices.html

After reading this again, it appears that you are selling the CPUs listed, with the Arduino bootloaders pre-installed? For some reason I thought you were saying that these devices could be used with the ZBasic IDE....

-Tony
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2991
Location: Portland, OR

Posted: 26 September 2017, 2:35 AM    Post subject: Reply with quote

spamiam wrote:
What are the RTC settings and other parameters it will use?
rtcFrequency = 500Hz, package=PDIP-28

The fact that the 28-pin package is assumed may be the origin of the issue you saw.

spamiam wrote:
After reading this again, it appears that you are selling the CPUs listed, with the Arduino bootloaders pre-installed?
That is correct, they are devices with the Arduino bootloader installed.
Back to top
spamiam



Joined: 13 Nov 2005
Posts: 739

Posted: 26 September 2017, 9:44 AM    Post subject: Reply with quote

I do not know for a fact that the ZA-328 is assuming the 28 or 32 pin package. As I recall the 32 pin has 2 extra analog-only pins and I am not using those in the project in question.

For my needs it is not critical to have the ZA-328 target function properly because I have a generic license. And maybe you do not want to spend time getting a target to compile properly (or work out the cause of the error) when that target does not actually exist in real life (other than user-modified Arduinos)
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic IDE Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2017 Elba Corp. All rights reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group