The DATAlogger is the first of the multicore products. BASICtools
allows you to compile programs for both CPUs.
The M4 CPU is the master CPU and is the first to start up. The M4
initializes the system, and checks for valid BASIC code, and if there is valid
code it will launch both M4 and M0
The M4 CPU controls writes to Flash, interrupts for
UART0, and SDcard access. The M4 has a floating point unit so floating point math will be much faster on the M4
The M0 CPU can send debug information to UART0, but when it does so it uses
polling so it can potentially wait until UART0 is idle. The M0 can NOT
receive characters on UART0, as the M4 interrupt preempts them.
Other peripherals can be used by either CPU, but is up to the user to decide which
CPU has control. While in some cases you can share peripherals, it is
better to dedicate them to one CPU or the other. This is especially true
for interrupts, the M0 can setup interrupts, but if that interrupt is setup by
the M4, results are not predictable.
When BASICtools begins, it does not check to see which type of board it is
connected to. But when you load the first program it determines that this
is a multicore chip and adds the ability to select the core in
the upper right hand corner.
By default the M4 (master CPU) is the first to be loaded
with a program. Note that any program loaded into the M0 will be executed in
parallel with the M4 program.
When you switch to load programs on
the M0, the M4 will be loaded with a short program that starts the
M0 and then the M4 terminates.
Both CPUs can access RAM at &H2000C000, it can be used for mailbox, shared
data or other communication between the CPUs. Pointers can be used access
there. A future version of the compiler will allow sharing of some global
variables between the 2 CPUs.
The intended method of debugging is to
debug programs separately, then once the program is operating correctly load the
M0 CPU program, then load the M4 program. After that when the
program runs, both CPU programs will be executed.
When the M4 starts up it looks for a valid
program in both M4 and M0 memory, and if found they will be started. The
easiest way to "erase" programs in both memories is to select the
M0 CPU and type PRINT into the command then
push the RUN
That starts you off with a clean slate.