This document shows the step-by-step process to create a simple project which recreates the included example 'hello_world_s32v234'. The purpose of this demo is to provide the user with an example application for S32V234 platform, using S32 SDK. The demo toggles two LEDs (PTA8 and PTA9). This HW used in this demo is the SBC-S32V234 EVB, connected to a PC through NXP's S32 Debug Probe or P&E Micro's debug probe. Setup S32 Design Studio 3.1 or later installed AND S32V2xx development package installed SBC-S32V234 EVB connected to power AND switched ON Either S32 Debug Probe OR P&E Micro debug probe connected to the SBC-S32V234 EVB through JTAG connection. S32 Debug Probe connected to PC via either USB cable OR Ethernet cable (also requires power via included power supply and connected to USB port). For more information on HW setup, see HOWTO: Start Debug on an ISP Application Project with S32 Debugger and S32 Debug Probe . P&E Micro debug probe connected to PC via USB cable Procedure Create a new application project for M4 core File -> New -> S32DS Application Project Enter project name, select processor S32V234 Cortex-M4, click Next. Click '...' to select the SDK Select S32V234 SDK v1.0.0 (or later version) Notice the box is now checked for S32 Configuration Tool. The S32 Configuration Tool is dependent upon the S32 SDK. Select either S32 Debugger (default) or PE Micro GDB server. Click Finish The new project appears in the Project Explorer, notice the S32V234_M4.mex file is there as well. This .mex file contains all of the configuration data for the S32 Configuration Tool for this project. After clicking on the project name, the toolbar icon for the S32 Configuration Tool is now active. Click the S32 Configuration Tool button or double-click on the .mex file to open the S32 Configuration Tool perspectives. Notice the new perspective buttons in the toolbar: Go to Pins tool perspective, this is the default perspective that opens when the S32 Configuration Tool is launched. Notice there are errors at the lower right. There is a dependency upon the PINS driver from the S32 SDK. This driver is not mandatory, and while there are some rare cases where the drivers would not be needed, in most cases the user should choose to include them. To resolve the error, right-click on the error message to bring up the context menu and then select the option Add SDK component 'PINS' into the project '<project_name>'. After selecting the context menu option, you are presented with a confirmation window to review the list of files which will be added to the project. In this case, the option did not result in any new files, so there is nothing to review. You can check a box to avoid seeing this confirmation window in the future. Click Yes to confirm the changes. Select the Peripheral Signals tab at the upper left of the Pins perspective Check box for SIUL2 In the popup window Peripheral SIUL2, scroll to find gpio, 8 >> [A11] PA8 and gpio, 9 >> [B11] PA9. Check the box next to each. For each pin that is selected, an additional popup menu appears. Set both pins as Output. Then click OK and then Done. Set Identifiers for each as follows Pin Identifier PTA8/A11 LED1 PTA9/B11 LED2 Go to Peripherals tool Select Peripherals tab at upper left, check box to enable MC_ME Click OK. Now the driver is installed. Go to Clocks tool Change the following settings. They are not Run Mode specific. Hovering the mouse pointer over the object in the diagram will produce a tooltip window with information about the object including the name, current setting, output value, etc. Change prescaler ENETPLL_PHI0 (.pll2Config/.phi0Divider) from 2 to 8 Change the setting by first clicking on the prescaler box in the diagram, then clicking on the value in the 'Details' panel to the right. This brings up a list of available values. Select the desired value from the list. Once successfully changed, the values will be highlighted. Alternatively, a double-click on the value inside the prescaler box will bring up a drop list of the values and the selection can be made. Change prescaler VIDEOPLL_PHI0 (.pll4Config/.phi0Divider) from 4 to 2 Change mux AUX0_MUX (CGM0_AUX0_MUX) from FIRC to DDRPLL_DFS1 Change mux AUX8_MUX (CGM0_AUX8_MUX) from FIRC to DDRPLL_PHI0 To locate the next two, it is necessary to scroll down on the Clocks Diagram: Change mux CGM0_AUX7_MUX (MC_CGM_0_AUX7_MUX) from FIRC_CLK to ENETPLL_PHI0 Change mux CGM2_AUX2_MUX (MC_CGM_2_AUX2_MUX) from FIRC_CLK to ENETPLL_PHI0 Click Update Code Click OK Switch to C/C++ perspective Insert pins init using the configuration from 'board\pin_mux.c' If not already open, double-click on the following files from Project Explorer: 'board\pin_mux.c' 'src\main.c' Use the SDK Explorer Go to Quick Access field and enter 'sdk' Select 'SDK Explorer' If needed, drag the new SDK Explorer tab to the pane you prefer. In general, for this tool, a taller tab window works better. Select the project name in the Project Explorer tab and then expand the list under the SDK until you can see the list of CLOCK_DRV function defines. Drag and drop the function 'CLOCK_DRV_Init()' into main() of 'main.c', after the comment '/* Write your code here */'. Now locate the PINS_DRV function defines. . Drag and drop the following functions into the main() function of 'main.c', after the function call CLOCK_DRV_Init(): PINS_DRV_Init() PINS_DRV_ClearPins() The function calls are not in the format we need so let's modify them: Drag and dropped from SDK Explorer Change to this for our application status_t = CLOCK_DRV_Init(const clock_user_config_t*); CLOCK_DRV_Init(&clock_InitConfig0); status_t = PINS_DRV_Init(uint32_t, const pin_settings_config_t[]); PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr); PINS_DRV_ClearPins(GPIO_Type* const, pins_channel_type_t); PINS_DRV_ClearPins(LED1_PORT, ((1<<LED1_PIN)|(1<<LED2_PIN))); clock_InitConfig0 is defined in 'board/clock_config.c' NUM_OF_CONFIGURED_PINS, LED1_PORT, LED1_PIN, LED2_PORT, LED2_PIN are defined in 'board/pin_mux.h' g_pin_mux_InitConfig_Arr is defined in 'board/pin_mux.h' LED1_PORT == LED2_PORT Replace the contents of the FOR loop to toggle the pins (PINS_DRV_TogglePins() comes from SDK Explorer) Original New for(;;) { if(exit_code != 0) { break; } } for (;;) { /* Insert a small delay to make the blinking visible */ delay(720000); /* Toggle output value LED1 & LED2 */ PINS_DRV_TogglePins(LED1_PORT, (1 << LED1_PIN)|(1 << LED2_PIN)); } Insert delay function code in main.c delay() void delay(volatile int cycles) { /* Delay function - do nothing for a number of cycles */ while(cycles--); } Now main.c should look as follows Build the project Now we have the ELF file We are ready to run on the hardware. Open the Debug Configurations Select the debug configuration within the debugger grouping for the debugger that was chosen in the new project wizard (step 1f), and for build type Debug_TCM S32 Debugger/S32 Debug Probe Select the Debugger tab. Some setup is required to configure how we are connected to the S32 Debug Probe There are two options: Ethernet USB If connecting the Probe via Ethernet, please refer to the Quick Start Guide or S32 Debug Probe User Guide provided with the S32 Debug Probe for instructions on how to connect it and determine the Hostname or IP address. If connecting the Probe via USB, then the COM port will appear in the Port selection setting. If you have more than one S32 Debug Probe connected, you will need to determine which COM port is the correct one, otherwise, only the COM port for your S32 Debug Probe will appear. PEMicro GDB Server When debug probe setup is done, then click Debug to run the code. Agree to launch the debug perspective Now the debugger starts and you can see it has stopped on the default breakpoint at the first line in main(). From here you can Resume, Step, set a breakpoint, set watch variables and monitor registers. If you Resume, then you will see the LEDs on the EVB blinking. You can set a breakpoint on the PINS_DRV_TogglePins() and use Resume to see the LEDs come on and off.
記事全体を表示