S32 Design Studio Knowledge Base

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32 Design Studio Knowledge Base

Discussions

Sort by:
S32 Design Studio (S32DS) for ARM supports IAR Plugin, and the user can use IAR specific features in S32DS with IAR toolchain for ARM. This document describes the way to convert S32DS project to IAR EW based project using project exporting wizard in S32DS. This guidance is based on the NXP S32K144 microcontroller, and compatible with S32K14x / S32K11x family.   The version of each IDE which is used for this document is as follows: S32 Design Studio for Arm 2018.R1 IAR Embedded Workbench for ARM 8.32.1.18631     1. Install IAR Plugin using IAR Embedded Workbench plugin manager on S32DS Help - Install New Software   Put "IAR Embedded Workbench for Eclipse " as the repository for new installation of software.     Help - IAR Embedded Workbench Plugin Manager     Install IAR Plugin which is matched with your IAR version.         2. Create S32DS Project File - New - S32DS Application Project   The tool chain should be chosen as IAR Toolchain. Be noted that the IAR 7.x toolchain is different from the IAR 8.x.   The project is created as follows.     3. Export S32DS Application Project File - Export   Choose S32 Design Studio - Project Info Export Wizard   Now "ProjectInfo.xml" was created. "ProjectInfo.xml" should be used for creating a project in the IAR EW.   4. Create IAR EW Project The way to create IAR project as described below. The snapshots are based on IAR EW 8.32.1. Details may vary.   5. Connect the Project Use the menu - Project - Add Project Connection, and choose "Freescale Processor Expert".   Select the "ProjectInfo.xml" file which was created at step #3.    Now, the project which had been created in IAR was connected to the S32DS project.   The created IAR project should be modified if the user wants to use the project with S32DS SDK to build and debug under IAR EW environment as follows.   1. Modify the Linker configuration and remove ProjectInfo.xml Remove "ProjectInfo.xml"   Linker configuration from the project Options   Even though the user modified the linker configuration, a definition in IAR EW  for "device_registers.h" from SDK will cause build error when trying building the project.   This error will be eliminated by inserting Chip specific definition into IAR project. If you take a look into the "device_register.h", you can find the definition as follows.   2. Define symbols  Right mouse click on the Project name - Options   Write the symbols referred from "device_register.h". The symbols may vary (e.g., CPU_S32K146, CPU_S32K142, ...).   3. Build and Debugger configuration Options - Debugger   I used PE micro's OpenSDA on S32K144EVB for this document. After choosing debugger and clicking Download and Debug (Ctrl+D), you can see the P&E Configuration Manager as follows. Just choose appropriate configuration, and select the correct part number of S32K by clicking Select New Device.   Finally, you can download and debug the converted IAR EW project with S32DS SDK.
View full article
Migrating an SDK project for S32K1xx devices between SDK v4.0.1 and v4.0.2 is not as simple as attach and detaching the SDKs. It is complicated by the fact that SDK v4.0.1 is supported by only S32DS v3.3 and SDK v4.0.2 is supported by only S32DS v3.4. So this means both SDKs will not be present at the same time in one version of S32DS. In addition, the method for attaching the SDKs changed between SDK v4.0.1 and v4.0.2. In v4.0.1, the SDKs were added to the S32DS project via a link. In v4.0.2, the SDK files are added to the S32DS project by copying the actual files into the project. To overcome this, it is necessary to perform some manual operations. The steps required are detailed in this document, along with the necessary steps to adapt the .mex file containing the S32 Configuration Tools settings. Due to differences in projects based on the method of creation, there are 3 scenarios to be covered here which are assumed to be the most common: Project was created by 'New Project from Example' wizard and one of the SDK example projects was selected. Project was created by 'New Application Project' wizard and the SDK was selected for attachment within the wizard. Project was existing one and SDK was attached using the SDK management tool. Due to enough similarities between the projects, the last two will be covered as one scenario, under the heading 'New Application Project'. The first one will be covered under the heading 'New Project from Example'. Prerequisites Install S32 Design Studio IDE 3.4 Install the S32K1xx development package and S32SDK S32K1XX RTM 4.0.2 package Procedure New Project from Example For this demonstration, the S32K1xx SDK v4.0.1 example project 'flexio_i2s_master_s32k144' will be used. Open or create the project within S32DS 3.3 Expand project directory in Project Explorer and look for .mex file If no .mex file is present, then right click on project name and select 'S32 Configuration Tool -> Open Pins' (could select any tool within S32 Configuration Tool). Even though the .mex file contains the settings for S32 Configuration Tools, the same settings are also preserved in YAML code placed into the headers of each of the .c files generated by the S32 Configuration Tools into the 'board' folder in the project. By opening the S32 Configuration Tools, it detects there is no .mex file and scans the generated files for the YAML code. If YAML code is found, then a new .mex file is produced and placed in the project. The perspective is changed to the Pins Tool, nothing more needs to be done, .mex file has been created from the YAML code. If no YAML code had been found, then the user would be presented with a menu to select target device and SDK. Switch back to C/C++ perspective to confirm. Open S32DS 3.4 and import the project. It is important to note that separate workspaces should be used for S32DS 3.3 and S32DS 3.4. The project should be imported into the S32DS 3.4 workspace so the checkbox 'Copy projects into workspace' should be ticked. Right-click on Project -> Properties -> C/C++ Build -> Settings -> Standard S32DS C Compiler -> Includes, then delete all paths which contain 'S32_SDK_PATH' Repeat for Standard S32DS Assembler -> General Apply and Close The files in the SDK folder were included in the project as links and not actual files, and since the SDK 4.0.1 is not installed to S32DS 3.4, the links point to non-existing files. This means the Attach function in the SDK manager will not be able to replace them with the corresponding files from SDK 4.0.2 because it doesn't know how to replace files which don't exist. From Project Explorer, delete folder ' SDK' from the project. Now the project is ready to use the SDK manager to detach the old SDK and attach the new SDK. In Project Explorer, right-click on Project -> SDKs. When the SDK manager launches, it scans the project for any attached SDKs. In the case of this example, an SDK is detected as attached, but since it does not match any installed SDKs, a message appears asking to detach SDK 4.0.1. Since this is a desired action, click OK. With SDK 4.0.1 already detached, select SDK 4.0.2, click 'Attach/Detach...' Click 'Select All' to attach the SDK to all build configurations. This sets up the include paths, and linker paths for the SDK for each build configuration. If desired, the build configurations could be selected individually. Click OK to complete the selections. To apply the changes and exit the SDK manager, click 'Apply and Close'. The SDK Manager detects that some of the files from the new SDK are replacing existing files in the project. By default, all conflicting files are set to replace the existing file. If desired, individual files can be deselected. Please note, with the checkbox for 'Backup project files' ticked, any files replaced will be preserved in a backup folder for future recovery, comparison, etc. In general, it may be wise to allow the file to be replaced and later merge with the customizations in the backup folder. For this example, no modifications were made, so default settings are kept. Click OK to complete the process. The new SDK is attached and the new SDK folder can be identified. The .mex file contains the settings for the S32 Configuration Tools, however, it is still set for the SDK 4.0.1. It must be manually updated so the S32 Configuration Tools can be used to generate the new code for the 'board' folder. Right-click on .mex file and select 'Open With -> Text Editor'. All that is required is to modify the mcu_data section containing the SDK name: 's32sdk_s32k1xx_rtm_401' -> 's32sdk_s32k1xx_rtm_402' Now save the change. Next, the files in the 'board' folder must be regenerated from the S32 Configuration Tools to reflect the new SDK. Right-click on the .mex file and select 'Open With -> S32 Configuration Tools'. A warning message appears indicating that it has detected the mex file was created in an older version of the tool and that once the mex file is saved in the current tool, it may no longer open in an older version of the tool. This is expected. Click OK. Notice the error symbol. Mouse-over to see the details. It is an error with Peripherals tool. Select Peripherals tool. The issue is with edma_config_1, because it is highlighted red. Click on it to see the interface. The interface changed from the previous version to allow for multiple configurations where previously it supported only one. To resolve the error a new configuration must be added to the list. Click on the '+' as shown to add the new configuration. This particular error will only appear for projects which include the EDMA module. The Problem Indicator is now green, this means there are no warnings or errors. It is now time to generate the code, click 'Update Code' A menu appears identifying new and/or updated files. If desired, selecting 'change' on a row will open a comparison tool showing the changes between the existing and the new versions of the associated file. Click OK to proceed. Switch to C/C++ perspective Errors on project are now gone. If the project successfully built before the conversion, then build again to confirm everything was converted properly.   New Application Project For this demonstration, a new project will be created in S32DS 3.3 using the New Application Project wizard and the S32K1xx SDK 4.0.1 will be selected during project creation. Import the project into S32DS 3.4 Use the SDK Manager to detach the old SDK and then attach the new SDK. In Project Explorer, right-click on Project -> SDKs. When the SDK manager launches, it scans the project for any attached SDKs. In the case of this example, an SDK is detected as attached, but since it does not match any installed SDKs, a message appears asking to detach SDK 4.0.1. Since this is a desired action, click OK With SDK 4.0.1 already detached, select SDK 4.0.2, click 'Attach/Detach...' Click 'Select All' to attach the SDK to all build configurations. This sets up the include paths, and linker paths for the SDK for each build configuration. If desired, the build configurations could be selected individually. Click OK to complete the selections. To apply the changes and exit the SDK manager, click 'Apply and Close'. The SDK Manager detects that some of the files from the new SDK are replacing existing files in the project. By default, all conflicting files are set to replace the existing file. If desired, individual files can be deselected. Please note, with the checkbox for 'Backup project files' ticked, any files replaced will be preserved in a backup folder for future recovery, comparison, etc. In general, it may be wise to allow the file to be replaced and later merge with the customizations in the backup folder. For this example, no modifications were made, so default settings are kept. Click OK to complete the process. The .mex file contains the settings for the S32 Configuration Tools, however, it is still set for the SDK 4.0.1. It must be manually updated so the S32 Configuration Tools can be used to generate the new code for the 'board' folder. Right-click on .mex file and select 'Open With -> Text Editor'. All that is required is to modify the mcu_data section containing the SDK name: 's32sdk_s32k1xx_rtm_401' -> 's32sdk_s32k1xx_rtm_402' Now save the change. Next, the files in the 'board' folder must be regenerated from the S32 Configuration Tools to reflect the new SDK. Right-click on the .mex file and select 'Open With -> S32 Configuration Tools'. A warning message appears indicating that it has detected the mex file was created in an older version of the tool and that once the mex file is saved in the current tool, it may no longer open in an older version of the tool. This is expected. Click OK. Check for any errors or warnings by looking for the yield sign. It will change color based on the conditions: Green = No Problems, Yellow = Warnings, Red = Errors. Mouse-over the icon for more information on the location of the error. Aside from resolving warnings and errors, there should be no changes required as the settings have been preserved from the original project. In this example, there are no warnings or errors, so it is possible to proceed with updating the generated files. Click 'Update Code' A menu appears identifying new and/or updated files. If desired, selecting 'change' on a row will open a comparison tool showing the changes between the existing and the new versions of the associated file. Click OK to proceed. Change back to C/C++ perspective. Errors on project are now gone. If the project successfully built before the conversion, then build again to confirm everything was converted properly.
View full article
When a new application project is created using the New Project Wizard, it is possible to select the debugger to be used. This results in the associated debugger configurations being created within the new project. But what if support for multiple debuggers is required or it is desired to switch to a different debugger? There are easy ways to resolve this. One is as simple as creating a new debug configuration. Another method is by creating new application project, selecting the new debugger to be supported. Then either repurposing the associated debug configuration or duplicating then modifying the debug configuration to support instead the previously existing project. This minimizes the effort by benefiting from the automation of the New Project Wizard.   Detailed below are the steps to add a new debug configuration.  Create A New S32 Debugger Configuration Load the existing project. For this demonstration, the SDK project ‘hello_world_s32v234’ will be used. Select the project so it appears highlighted in blue. Notice that the other project, ‘New_App_Project’, is bold text. This is because the main.c file open in the editor window to the right is the currently selected source file and is from this project. This has no effect on the process detailed in this document. Check that the existing project has been build and the executable is present. If the executable is not present, then an error will be displayed within the Debug Configurations menu and the executable file will need to be selected in a later additional step after it has been created. Open the Debug Configurations menu. Run -> Debug Configurations   Now select the Debugger Group for which you wish to create the new configuration. In this case, we will select ‘S32 Debugger’. Next, click ‘New Launch Configuration’ Now a new Debug Configuration has been created for your project and for the S32 Debugger. Most of the fields are already completed for you. Select the Debugger tab to see the source of the error message. The error message indicates ‘Specify Device and Core’. So click on ‘Select device and core’. Now expand the lists until the Device and Core are visible. Select the correct core for your project. In the demonstration example, the correct Device and Core are ‘S32V234’ and ‘M4’, respectively. Click OK, when done. If you have a debug probe connected, it may have been detected. If not, the Debug Probe Connection section will need to be completed. Now select the ‘Common’ tab to setup the storage location for this new Debug Configuration. Select ‘Shared file’ and then ‘Browse…’ Expand the lists until ‘Project_Settings/Debugger’ is open. Select ‘Debugger’, then click OK. Now the basic debug configuration settings are complete. It is now ready to be used and the Debug button could be clicked to start debug. Otherwise, you may have more customizations to make, such as for Attach Mode. Repurpose S32 Debugger Configuration From A New Project Create new project New -> S32DS Application Project New Project Wizard, processor and toolchain page Enter a project name Select the device and core to match the existing project If necessary, select the toolchain to match the existing project Click Next New Project Wizard, cores and parameters page Select the number of cores to match the existing project Select the debugger, S32 Debugger If necessary, select other parameters to match the existing project Click Finish Open existing project which does not already have the S32 Debugger debug configurations (for this demonstration, we will use the hello_world_s32v234 example project from the S32 SDK) Copy debug configurations and modify settings to adapt to existing project Run -> Debug Configurations... Debug Configurations window Within the S32 Debugger grouping, select the debug configuration for the new project which corresponds to the build configuration and core of the existing project Change the name of the debug configuration. Change the portion of the name containing the project name to match the name of the existing project. Main tab Project field Click Browse... Select existing project C/C++ Application Click Search Project... Select the Elf file Common tab Save as field Click Browse... Select {existing_project_name}\Project_Settings\Debugger Debugger tab, Debug Probe Connection Setup connection parameters Click Apply Repeat as needed for all core/build config options The existing project now has the S32 Debugger configurations and is ready for debug with the S32 Debug Probe.
View full article
S32DS contains many example projects from which you can learn how S32DS can be used with the help of the Vision SDK to develop vision applications. The example projects contain generated and hand-written code, which utilize the Vision SDK to demonstrate a workflow using S32DS. In this document, the procedure for creating a project from one of the provided ISP examples through to execution on the EVB is detailed. This project was run using S32DS version 3.2 and VSDK version 1.5.0.   1) Launch S32DS 2) Select 'File -> New -> S32DS Project from Example' 3) Select 'isp_h264dec_single_stream' project    In this particular project, the ISP graph diagram is included. If you wish to view it, go to the Project Explorer panel and expand 'isp_h264dec_single_stream_graph'. Then double click on 'ISP data flow : h264dec_single_stream'. The ISP graph diagram will appear in the editor panel. 4) If not in the C/C++ Perspective, switch over by clicking on the icon showed below (Hovering over the correct icon should display 'C/C++'). The current perspective is displayed on the top bar. 5) Select isp_h264dec_single_stream: A53 in the Project Explorer panel 6) Build project for A53  7) Start a debug session using method as described in HOWTO Create A53 Linux Project in S32DS for Vision, beginning at step 9. 😎 Click Resume  The program takes the input H264 encoded image img_1280x960.h264 located in the /home/root/vsdk/data/common folder on the Linux BSP and outputs it on the display The output image should look like below.
View full article
S32DS contains many example projects from which you can learn how S32 can be used with the help of the Vision SDK to develop vision applications. The example projects contain generated and hand-written code, which utilize the Vision SDK to demonstrate a workflow using S32DS. In this document, the procedure for creating a project from one of the provided APEX2 examples through to execution on the EVB is detailed. This tutorial was made with S32DS Version 3.2 and VSDK Version 1.5.0. 1) Launch S32DS 2) Select 'File -> New -> S32DS Project from Example' 3) Select apex2_rotate_180 project 4) Click Finish 5) If not in the C/C++ Perspective, switch over by clicking on the icon showed below (Hovering over the correct icon should display 'C/C++'). The current perspective is displayed on the top bar. 6) Select apex2_rotate_180: A53 in the Project Explorer panel. Build the project using build config 'TEST_A53'. 7) Start a debug session using method as described in HOWTO: Create A53 Linux Project in S32DS for Vision, beginning at step 9. 😎 Click Resume  The program takes the input image  in_grey_256x256.png located in the /home/root/vsdk/data/common folder on the Linux BSP and rotates it 180 degrees The output image out.png is located inside the /home/root/vsdk folder 9) To see the output, access the device from the remote systems view. If this has not been set up, complete the steps described in HOWTO: Access Linux BSP file system on S32V234-EVB from S32DS for Vision.  10) Open both the input and output files from the remote systems view to verify that the program ran correctly.
View full article
In this document, we show the steps to use the New Project Wizard to create a new application project for APEX2, ISP, or both.   1. Launch S32DS for Vision 2. Select File -> New -> S32DS Application Project 3. Enter a name for the project 4. Select the 'A53 APEX2/ISP Linux' processor option 5. Click Next 6. Select the APEX2/ISP options you need.       a. APEX2 programming - will add support to your project for an APEX2 application, you need this for any new APEX2 project       b. ISP programming - will add support to your project for an ISP application, you need this for any new ISP project       c. ISP visual modeling - will create a separate project for your ISP data flow diagram, you will not need this if you plan to use an existing graph diagram. This can also be created later. 7. Select the SDK(s) as appropriate for your setup. For example, 'VSDK_MODULE_WIN' for Windows OS or 'VSDK_MODULE_LINUX' for Linux OS, the one which corresponds to your OS is selected for you by default. 7. Click Finish 8. You now have a project or set of projects for development on the S32V234.
View full article
In this document, the steps to create a new S32 Design Studio project from example will be detailed. 1. Launch S32 Design Studio 2. Select File -> New -> S32DS Project From Example 3. Select one of the projects, for example, hello_world_s23v234. Click Finish. 4. The project is added to the current workspace. It is ready to be built and can be executed on the target.
View full article
This document shows, how to set optimization level for whole project and how to edit single files with different optimization level. As soon as the project is created, it has set optimization level to 0 by default. This means, compiler do neither size optimization nor speed optimization. Optimization level can be set for every project according to the project requirements. 1) Optimization level set Right click the project and select project properties. Click C/C++ Build ->Settings->Standard S32DS C Compiler ->Optimization. You can see, optimization level is none -O0. Click the arrow on the right side of the list and choose the required optimization level. There are five options you can choose. Details description of the options are included in S32DS reference manual. Chosen optimization is used for all files in the project. 2) Change optimization level for single file in the project If you want to change optimization level for single file and do no affect another files, select required file, right click on it and select properties. As you can see, there are limited possibilities to set the file itself. Select required optimization level, click apply and close the window. Now, selected file has different options than the rest of the project. Hope it helps. Martin
View full article
In this document, we show the steps to use the New Project Wizard to create a new application project for APEX2, ISP, or both.   1. Launch S32DS for Vision 2. Select 'S32DS Application Project' 3. Enter a name for the project 4. Select the 'A53 APEX2/ISP Linux' processor option 5. Click Next 6. Select the APEX2/ISP options you need.       a. APEX2 programming - will add support to your project for an APEX2 application, you need this for any new APEX2 project       b. APEX2 visual modeling - will create a separate project for your APEX2 program diagram, you need this to connect your APEX2 graph diagrams together. But you could also create it separately later. The APEX graph diagram must be created separately with another New Project Wizard.       c. ISP programming - will add support to your project for an ISP application, you need this for any new ISP project       d. ISP visual modeling - will create a separate project for your ISP data flow diagram, you will not need this if you plan to use an existing graph diagram. This can also be created later.       e. ISP static sequencer - by default, a dynamic sequencer is generated from your graph diagram, enable this to generate a static sequencer instead. This can be set/changed later in the Emit Configurations. 7. Click Finish 8. You now have a project or set of projects for development on the S32V234.
View full article
Please note: AMMCLib SDK is standalone from S32/MPC SDK, it is intended for users who will not use the S32/MPC SDK. The AMMCLib SDK does not support all toolchains listed in S32DS new project wizard. For the toolchains it does support, It does not support all versions. The available SDKs will vary depending upon the toolchain which is selected. When creating a new S32DS Application Project, you may have noticed the S32K14x_AMMCLib_xxx SDK option in the Select SDK menu. This is the standalone version of the AMMCLib. If you plan to use one of the S32/MPC SDKs, then it most likely contains an integrated version of the AMMCLib. For this integrated case, the AMMCLib is accessed like any other S32/MPC SDK component and you would not need to add the standalone version. To add the AMMCLib SDK to your project, simply add it in the New Project Wizard (as pictured above) or add it later through the project properties menu, SDKs: Select the SDK from the list and then click 'Attach/Detach...' Click in the column for each build configuration for which you wish to have the SDK attached. You can remove SDKs by clicking the '+', causing it to disappear. It should also be noted that there exist example projects which demonstrate usage of the AMMCLib, though these show usage of the S32/MPC SDK integrated version. When working in your project, you can use the SDK Explorer to drag and drop macros and function calls into your code. To add the SDK Explorer view to your perspective, there are at least 2 methods: 1) Menu method a) Window -> Show View -> Other... OR Alt + Shift + Q, Q b) Filter on 'SDK' c) Select 'SDK Explorer' d) Click OK 2) Quick Access method a) Type 'SDK' b) Select 'SDK Explorer' To access the macros and function calls from the SDK Explorer: 1) Go to the Project Explorer and select your project to make it active. 2) Go to SDK Explorer and all of the SDKs you included in the project will be listed. 3) For the SDK you wish to access, expand the folders and files until you can see the function you wish to add. You can set some filters to hide unwanted content. 4) Simply drag and drop the macro/function call into your source file. The #include statement for the associated header file will be automatically added near the top of your source file. Happy math coding with AMMCLib!
View full article
S32 Design Studio (S32DS) for ARM supports IAR Eclipse plug-in that enables users to build and debug a S32DS project with IAR toolchain for ARM. This document describes how to install this plugin and how to enable IAR in the new project wizard. Current version of S32DS for ARM 2018.R1 supports IAR compilers  v7.x and v8.x. After the IAR eclipse plugin installation is finished you should be able to create, build and debug a new S32DS project (including SDKs) using IAR compiler/debugger interface directly under S32DS Eclipse environment.   Installation instructions First of all make sure you have IAR Embedded Workbench installed with a valid license from IAR. Now let's proceed to eclipse plug-in installation.   1. Install IAR Plugin manager  go to menu "Help" -> "Install New Software" and  click on "Add..." button to add a new IAR repository located here: http://eclipse-update.iar.com/plugin-manager/1.0 Tick " I Accept the terms of the license agreement" and click "OK" to accept unsigned content software Finally you proceed to the installation. When the plugin is installed you will be asked to restart S32DS Anytime you create a new workspace you will be asked to enter path to IAR Embedded Workbench IDE   2. Configure IAR plugins in IAR Embedded Workbench plugin manager Run IAR plugin manager (Menu "Help" -> "IAR Embedded Workbench plugin manager...") Select the ARM version (8.x) and click "Install" button.  Select all the IAR components displayed and proceed to installation by clicking "Next" button.   3. New IAR project in the project wizard You can now create a new project in S32DS and select IAR toolchain for ARM instead of default GCC compiler. There should appear a new item it the Debugger selection - "IAR plugin Debugger". Please choose this option if you intend to debug using IAR supported probes (e.g. I-jet) IAR specific panels and settings are now displayed in the project properties for a new S32DS project with the IAR options enabled (see above). There is a new category "IAR C-SPY Application" in the debug configurations panel that contains all the debug configurations for projects with IAR debug plugin option selected. The Debugger perspective now offers several IAR specific Views and features. Enjoy building and debugging with IAR Eclipse plug-in in S32DS!
View full article
Perhaps you are just using the S32DS for Power for the first time, and maybe you've seen the provided examples and want to learn a bit more about how they were created. Here are the steps to create a simple application for the MCP5748G MCU which toggles a pin causing one of the user LEDs to blink. This example includes use of the S32 SDK for Power Architecture. Please note: There are options in the steps below to cover the case of either the DEV-KIT(DEVKIT-MPC5748G) or Motherboard(X-MPC574XG-MB) with Daughtercard(X-MPC574XG-324DS) hardware EVBs. 1) Launch S32DS for Power 2) Select File -> New -> New S32DS Project 3) Enter a name for the project, such as 'BlinkingLED' 4) Locate, from the list of processors, Family MPC574xG -> MPC5748G, and select it. 5) Click Next 6) Uncheck the boxes for cores e200z4 and e200z2, leaving just e200z4 (boot) checked. This is because the application will run on the boot core and will not use either of the other two cores. 7) Click on the '…' button next to SDKs, in the column for BlinkingLED_Z4_0. 😎 Check the box next to MPC5748G_SDK_Z4_0_GCC to include support for the SDK within the new project and for the core we have selected. 9) Click OK 10) Click Finish to close the New Project wizard window and start the project generation. 11) Wait a minute or two for the project generation script to complete. 12) Go to the 'Components Library' view then locate and double-click on 'pit' component to add it to the project.  Alternatively, right-click and select Add to project. You can verify it was added by inspecting the 'Components - <project_name>' view. 13) With 'pit' selected in the 'Components - BlinkingLED_Z4_0' view, go to the 'Component Inspector' view to see the configurations for the PIT component. Locate the section for 'Configuration 0'. You may have to scroll down to see it. Change the 'Time period' setting to 500000 microsec(0.5 sec). Note that we are editing the settings for Clock configuration 'clockMan_InitConfig0', you will need the name of this configuration later. 14) Back in the 'Components' view, select 'pin_mux' component and return to the 'Component Inspector' view 15) From the 'Routing' tab, select the 'SIUL2' sub-tab and scroll down the Signals list until 'GPIO_0' (DEV-KIT) or 'GPIO_99' (Motherboard) is shown. 16) Change to the following settings: a. Pin/Signal Selection: PA[0] (DEV-KIT) / PG[3] (Motherboard) b. Direction: Output Pin PA0/PG3 is connected to user LED 2 on the evaluation board. 17) All configuration settings are now complete. Click Generate Processor Expert code button in the 'Components' view or use the menu bar Project-> Generate Processor Expert Code. 18) Wait for the code generation to complete. 19) Now, from the 'Project Explorer' view, the generated code is visible in the folder 'Generated_Code' of the project 'BlinkingLED_Z4_0'. 20) If not already open, in 'Project Explorer' open the file 'BlinkngLED_Z4_0\Sources\main.c' by double-click. This will open the file in the editor view. 21) Scroll down until the following comments are shown: /* Write your code here */ /* For example: for(;;) { } */ We need to add some code here to initialize the clocks, timers and pins. Then we will setup a timer interrupt handler to toggle the pin. 22) First we need to initialize the clocks. From the 'Components' view, expand 'clock_manager' and then drag & drop CLOCK_DRV_Init function into main() of main.c, just after the comments identified in the previous step within the text editor view. 23) Add to the function CLOCK_DRV_Init(), the parameter &clockMan1_InitConfig0 to give it the address of the user configuration structure generated by ProcessorExpert in '.../Generated_Code/clockMan1.c'. This is the clock configuration for which we edited the timer period in an earlier step. 24) Next we need to initialize the pins. Back in the 'Components' view, expand the 'pin_mux' then drag and drop the function PINS_DRV_Init after the clock initialization. 25) Again from the 'Components' view, expand 'interrupt_manager', then drag & drop INT_SYS_InstallHandler in 'main()'. This installs the PIT channel 0 interrupt handler. 26) Enter the parameters: PIT_Ch0_IRQn, &pitCh0Handler, NULL 27) In the User includes section at the start of main.c, add the implementation of the handler a. Create a function called pitCh0Handler b. In the function body: clear the interrupt flag and toggle LED   /* IRQ handler for PIT ch0 interrupt */   void pitCh0Handler(void)   { /* Clear PIT channel 0 interrupt flag */ PIT_DRV_ClearStatusFlags(INST_PIT1, 0U); /* Toggle LED (GPIO 0 connected to user LED 2) */ SIUL2->GPDO[0] ^= SIUL2_GPDO_PDO_4n_MASK; // DEV-KIT /* SIUL2->GPDO[99/4] ^=SIUL2_GPDO_PDO_4n3_MASK;*/ // Motherboard   } Note: Get PIT_DRV_ClearStatusFlags by drag & drop from the 'pit' component. 28) In 'Components' view, expand 'pit' component and then drag & drop PIT_DRV_Init, PIT_DRV_InitChannel & PID_DRV_StartChannel in main() after INT_SYS_InstallHandler(). 29) Fill in the second parameter of the last function(channel number): 0U 30) Build the code. Click the down arrow next to the 'Build' button and select Debug_RAM. Check that there are no build errors. 31) Enter the 'Debug Configurations' menu: a. From the menu bar, Run -> Debug Configurations... b. From the toolbar, down arrow next to Debug button -> Debug Configurations... 32) The Debug Configurations window appears. Select the configuration BlinkingLED_Z4_0_Debug_RAM from within the GDB PEMicro Interface Debugging group. 33) Select the 'Debugger' tab to setup the connection to the debugger hardware device. 34) Select the PEMicro Interface which corresponds to your setup: a. If using the motherboard, you will likely use the USB Multilink, which is connected to your PC via USB cable (type A on one end, type B on the other) and is connected to the motherboard via the 14-pin JTAG cable. b. If using the DEV-KIT board, you will likely choose the OpenSDA, which is integrated into the DEV-KIT board and is connected with just a USB cable (type A on one end, type micro on the other). 35) Click Debug To launch the debugging session. This will also open the Debug perspective. 36) In the Debug perspective, once the debugging session has fully launched, the code will be executed to the start of main(), where a breakpoint was automatically set for you. Press Resume button in the toolbar, Run -> Resume in the menu bar, or F8 on your keyboard to run the application. 37) You should now see the User LED2 on the board blink every 0.5 seconds. 38) To see the value of the output register bit for the output pin connected to the LED: a. Set a breakpoint on a line within pitCh0Handler() b. Go to the EmbSys Registers view, expand the SIUL2 module and scroll down to the GPDO register index which is accessed in the code. Double-click it to read the value. Expand it to see the individual bits. c. Press Resume a few times to see the register value change
View full article