How is a Native Mode app compiled?

A private (members-only) forum for discussing all issues related to the Beta test of Native mode devices.
Locked
mikep
Posts: 796
Joined: 24 September 2005, 15:54 PM

How is a Native Mode app compiled?

Post by mikep »

How do you determine whether the ZBasic compiler should generate ZVM or C code? I couldn't find this in the documentation.

It seems like the target code could also be specified in the BAS source using a new Option called TargetCode or outside using a command line option to the compiler such as

Code: Select all

--target-code=<ZVM,Native>
The native mode code generator (compiler) could be a different backend or a totally different compiler executable.

If you wanted to have your source code generate both ZVM and native code, how do you specify that to the IDE? Are there 2 additional menu commands or some other method?
Mike Perks
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: How is a Native Mode app compiled?

Post by dkinzer »

mikep wrote:How do you determine whether the ZBasic compiler should generate ZVM or C code?
It is automatic based on the target device. If you specify ZX24a as the target device, you'll get VM code and the download file will have a .zxb extension by default. If you specify the ZX24n as the target device, you'll get native code and the download file will have a .zxc extension by default.

The updated downloaders (both in the IDE and zload) handle either type of file correctly irrespective of the extension. The download files contain information about the target device and the downloaders query the attached device for its identity before downloading to confirm that it matches the target for which the code was compiled.
- Don Kinzer
mikep
Posts: 796
Joined: 24 September 2005, 15:54 PM

Re: How is a Native Mode app compiled?

Post by mikep »

dkinzer wrote:It is automatic based on the target device.
Obvious now you point it out. :oops:

But your explanation will help other people.
Mike Perks
Locked