Getting Started Example


This product requires an embOS installed according to the documentation embOS_NIOS2.pdf by SEGGER.

Rhapsody in C

Please verify the implementation of your compiler bridgetarget bridge, and RTOS bridge, in particular the functions WSTTarget_Init() and WST_RTOS_Init().

Open the Rhapsody project Blinky at the directory <your Rhapsody>\Share\WST_RXF_V5\<your product>\Samples\Model\Blinky:




TargetComponent is using the stereotype RXFComponent which is defined in the profile Strauss. Each RXF by Willert Software Tools comes with its own profile with the stereotype RXFComponent. RXFComponent sets the proper environment, some properies for the RXF and defines some Tags. These Tags are used by the Deployer so it will use relative paths inside your NIOS IDE project. The other profile referenced, WSTProfile, is used to set Rhapsody GUI details which makes it easier for you to view and maintain your models.

ExamplePkg, show the classes: SequentialController, ActiveController and LED:
The Rhapsody generated code from the ActiveController object results in a timer event, which is sent to the LED every 400 msec. The SequentialController object uses the LED_on() and LED_off() operations to switch another LED on and off, every 300 msec.


Select the proper environment via the Features and do this for both Configurations Debug and Release:



The Deployer which will deploy Rhapsody generated source files and some generated configuration files, needs information from your model on relative paths inside a NIOS IDE Eclipse project:



It uses Tags from the stereotype RXFComponent which you must specify for your Component:

Note Each Rhapsody model must have a reference to the Herschel profile and use the stereotype RXFComponent.
This will allow you to use the Tags. You can set them via the Features dialog for your component. Herschel.sbs is installed in <Rhapsody>\Share\WST_RXF_V5\<product>\Config\Profiles\Herschel_Profile_rpy

Use Code | Generate Debug to generate C code from this model, and accept the question to have the directory created for the Debug Configuration:




Use Code | Build TargetComponent.dat to generate




Now you can deploy the generated files. The model does not contain the location of your GettingStarted NIOS IDE project on your PC; the Deployer will maintain that information instead. This enables one to have the same project used by different persons at different locations; the installation of the Altera toolchain and NIOS IDE projects on various PCs may differ.


Deployer

The very first time that the Deployer must deploy a project, it will automatically launch in configuration mode and ask for path(s). Select Code | Run TargetComponent.dat to start the Deployer:




The Deployer will prompt for the path to your GettingStarted workspace or project, so you must specify Rhapsody\Share\WST_RXF_V5\<your product>\Samples\Code\GettingStarted:



If you do not use a library for the RXF, you must uncheck its checkbox so all RXF files are deployed.



After you saved the path to GettingStarted, the files are deployed to the NIOS IDE project:




Note You must add an entry in the Rhapsody Tools menu, which launces the Deployer in Configuration Mode.
This allows you to change the path used by the Deployer for your NIOS IDE project in case you want to use a different NIOS IDE project for your Rhapsody project, or in case you moved the NIOS IDE project. 


NIOS II IDE

Because the NIOS environment has problems with spaces in paths, for example the Rhapsody path, we use a batchfile UseMappedDrive.bat which you can find in <your Rhapsody>\Share\WST_RXF_V5\<your  product>\Tools. If you can not use drive R: because it is already in use, please modify this batchfile accordingly. You can do this via the Windows Start menu using the Willert Software Tools folder or create your own shortcut.

Now switch to the GettingStarted workspace the NIOS II IDE, which is installed in the directory <your Rhapsody>\Share\WST_RXF_V5\<your  product>\Samples\Model\Code:



The project GettingStarted contains a number of specific folders:
Do a Refresh first to update the IDE project:




If this is the first time, first Clean your build environment: you may run into problems due to Altera version differences, resulting in different paths. Clean all projects in the Workspace:



Now Build the application, in the order GettingStarted_syslib, CreateRXFLibrary and finally GettingStarted:




Now you can test it in the simulator or on hardware. You may need to create a different system library; please refer to our documentation how to do so.

Set a breakpoint in LED.c in the function rootState_dispatchEvent(). You can do this while you are still in the NIOS II C/C++ perspective:






Switch to the Debug perspective and select Resume when the simulator or debugger is waiting inside main():




Wait until the breakpoint in rootState_dispatchEvent() is hit. Next, remove this breakpoint and set a breakpoint in LED_on() and LED_off().



Note Please refer to the NIOS documentation by ALTERA and the embOS documentation by SEGGER so the Workspace matches your hardware. 


Copyright (c) Willert Software Tools GmbH. All rights reserved.