Start Back Next End
  
ZBasic System Library
ZBasic Microcontrollers
3
ZBasic Compiler Directives
Some of the compiler directives available for AVR devices are also available for ESP8166 while others
are not applicable to ESP8266 devices.  The following list gives the option words (e.g. Option
HeapSize) that are not allowed or are not useful for the ESP8266. 
Arduino
HeapSize
AtnChar
Language
CodeLimit
OCModulateEnable
DefaultISR
RamSize
ExtRamConfig
SerialReadStrobe
HeapLimit
TaskStackMargin
HeapReserve
X10Interrupt
Other than these and those described explicitly below, all other compiler directives are allowed and
function as described in the ZBasic Language Reference manual.
The following compiler directives are applicable to the ESP8266 (possibly with some limitations or
restrictions as noted).  Those that are unique to the ESP8266 are preceded by an asterisk.
*Option UserInit
This directive allows you to specify an initialization routine that is executed early in the startup procedure. 
The name of the subroutine should be specified following the UserInit keyword with at least one
intervening space.  For reference purposes, the subroutine specified by this compiler directive will be
executed after completing low-level ZBasic initialzation, including console serial port initialization, but
before the ZBasic sign-on (if enabled).  It is important to note that at the time the UserInit subroutine is
invoked the ZBasic module-level variables and objects have not yet been initialized.  For reference
purposes, all of this initialization is done in the ESP8266 user_init() routine.
Example: Option UserInit myInit
*Option UserPostInit
This directive allows you to specify an initialization routine that is executed after the initialization is
complete including the initialization of ZBasic module-level variables and objects.  The name of the
subroutine should be specified following the UserPostInit keyword with at least one intervening space. 
For reference purposes, this routine is invoked in the "initialization complete" callback set by the ESP8266
system_init_done_cb() API.
Example: Option UserPostInit myPostInit
*Option PersistentSize
ZBasic reserves a 4K block of Flash memory to serve as the ZBasic Persistent data store.  Due to the
design of the Flash chip, this entire block is written each time that one or more bytes are changed.  Since
it is usually the case that the entire block is not changed, it must be updated using a read-modify-write
strategy and a block of memory must be temporarily allocated from the heap for this purpose.
Since many ZBasic applications for the ESP8266 will use little or none of the Persistent memory, the
default Persistent size is much smaller than the maximum in order to reduce the demand on heap
memory for the update operation.  The default Persistent size is 128 bytes of which 16 bytes are reserved
for "system" use.  If your application needs more than the default 112 bytes of Persistent memory, you
can specify a larger size using this compiler directive, up to the maximum of 4096.  On the other hand, if
your application  uses fewer than the default 112 bytes you could also specify a smaller size using this 
Previous page Top Next page