-
Notifications
You must be signed in to change notification settings - Fork 8
ISense Shawn
The aforementioned concept of the Processor is the natural integration point between the simulator and the iSense firmware. There is a Shawn simulator implementation of the HAL interface that adapts the firmware API to a special Shawn processor type. It includes the radio as well as the most important hardware components. This so-called iSense-processor is part of the firmware and is used if iSense is compiled for the simulator.
If an iSense application shall run in the simulator instead of on the hardware, all that needs to be done is a change of the compilation target. Like this, the iSense firmware library, the Shawn simulator library and the iSense application are linked together and form a binary that is executable on a personal computer.
When the simulator is started and the use of iSense is configured in the simulator control file, Shawn automatically instantiates iSense and the application for each node in the simulation. Like this, the same iSense application can run either on real world hardware or within Shawn.
Experience has shown that running applications in the simulator is not only helpful for evaluating their performance prior to real world deployment. It is also extremely valuable during development and debugging. Providing a full-featured debugger, Shawn enormously speeds up the ripening of applications and protocols, and allows insights into their behavior that are impossible on the actual hardware.
Activate the following defines in the config.h
#define ENABLE_SERAERIAL_DEBUG
#define ISENSE_ENABLE_ISHELL_INTERPRETER
#define ISENSE_ENABLE_ISI_TIMEHANDLING
#define ISENSE_ENABLE_ISI_SERAERIAL
#define ISENSE_ENABLE_ISI_BUFFERSENDING
Create an iShellInterpreter in the application:
IShellInterpreter* isi = new IShellInterpreter(os);
isi->enable_seraerial();
In the .jshawn file the line shawn.runCommand("ShawnSocketTask","socket_port=1280 socket_blocking=true"); creates a socket on listening at blocking port 1280. The parameter socket_blocking defines if the simulation will wait until the connection has been established.
For each ShawnSocketTask in the .jshawn file open an iShell. The address has to be set to localhost and the port to the value set in the .jshawn file. Main node sets links the iShell to one node. The range debug nodes specifies the set of nodes from which messages will be transmitted to the iShell. If you run the application the output will be shown in the Serial Monitor plugin.