Hi,
Thanks for your reply!
This statement means that the installation is unsuccessful on Windows PC due to the same error that mentioned earlier but after the unsuccessful installation, a folder is created which is extracted info from exe file that exist all the files, documentations, and examples. Since I am running on my Ubunutu Laptop S32DS for Power Architecture without issue, I tried to run the ENET ping example existed in the extracted folder on my S32DS for PA. But, as mentioned, the Cpu.h is missing in the extracted folder from exe file of S32SDK. I assume that this can be generated when S32SDK can be installed properly which in my case does not, due to the last reason. So what should I do? in my S32DS for PA on my Ubuntu, there are not any examples for S32R274, that's why I need the Cpu.h file or I need to install the S32DSK properly. What should we proceed?
The following is the main file of ENET ping example but the folder does not include the Cpu.h header file.
###################################################################
** Filename : main.c
** Project : S32R274_Z4
** Processor : S32R274_257
** Version : Driver 01.00
** Compiler : GNU C Compiler
** Abstract :
** Main module.
** This module contains user's application code.
** Settings :
** Contents :
** No public methods
**
** ###################################################################*/
/*!
** @file main.c
** @version 01.00
** @brief
** Main module.
** This module contains user's application code.
*/
/*!
** @addtogroup main_module main module documentation
** @{
*/
/* MODULE main */
#include "Cpu.h"
volatile int exit_code = 0;
#define GPIO_PORT PTA
#define LED 0U
#define FRAME_ETH_DEST_MAC_OFFSET (0U)
#define FRAME_ETH_SRC_MAC_OFFSET (6U)
#define FRAME_IP_PROTO_OFFSET (23U)
#define FRAME_IP_CHECKSUM_OFFSET (24U)
#define FRAME_IP_SRC_OFFSET (26U)
#define FRAME_IP_DEST_OFFSET (30U)
#define FRAME_IP_PROTO_ICMP (1U)
#define FRAME_ICMP_TYPE_OFFSET (34U)
#define FRAME_ICMP_CHECKSUM_OFFSET (36U)
#define FRAME_ICMP_TYPE_ECHO_REQUEST (8U)
#define FRAME_ICMP_TYPE_ECHO_REPLY (0U)
void copy_buff(uint8_t *dest, uint8_t *src, uint8_t len)
{
uint8_t i;
for (i = 0; i < len; i++)
{
dest[i] = src[i];
}
}
void delay(volatile int cycles)
{
/* Delay function - do nothing for a number of cycles */
while(cycles--);
}
void build_ping_reply(uint8_t *data)
{
uint8_t src_ip[4] = { 0xc0, 0xa8, 0x00, 0x14 }; /* 192.168.0.20 IP of board */
/* Clear IP and ICMP checksums (to be filled in by the MAC) */
data[FRAME_IP_CHECKSUM_OFFSET] = 0;
data[FRAME_IP_CHECKSUM_OFFSET + 1] = 0;
data[FRAME_ICMP_CHECKSUM_OFFSET] = 0;
data[FRAME_ICMP_CHECKSUM_OFFSET + 1] = 0;
/* Update ICMP type to represent an echo reply */
data[FRAME_ICMP_TYPE_OFFSET] = FRAME_ICMP_TYPE_ECHO_REPLY;
/* Update MAC and IP addresses */
copy_buff(&data[FRAME_ETH_DEST_MAC_OFFSET], &data[FRAME_ETH_SRC_MAC_OFFSET], 6);
copy_buff(&data[FRAME_ETH_SRC_MAC_OFFSET], ethernet1_MacAddr, 6);
copy_buff(&data[FRAME_IP_DEST_OFFSET], &data[FRAME_IP_SRC_OFFSET], 4);
copy_buff(&data[FRAME_IP_SRC_OFFSET], src_ip, 4);
}
void rx_callback(uint8_t instance, enet_event_t event, uint8_t ring)
{
status_t stat;
if (event == ENET_RX_EVENT)
{
enet_buffer_t rxBuff;
stat = ENET_DRV_ReadFrame(INST_ETHERNET1, ring, &rxBuff, NULL);
while (stat == STATUS_SUCCESS)
{
if (rxBuff.length < FRAME_ICMP_TYPE_OFFSET)
{
ENET_DRV_ProvideRxBuff(INST_ETHERNET1, ring, &rxBuff);
stat = ENET_DRV_ReadFrame(INST_ETHERNET1, ring, &rxBuff, NULL);
continue;
}
/* Check that the received frame was an ICMP echo request */
if (rxBuff.data[FRAME_IP_PROTO_OFFSET] == FRAME_IP_PROTO_ICMP &&
rxBuff.data[FRAME_ICMP_TYPE_OFFSET] == FRAME_ICMP_TYPE_ECHO_REQUEST)
{
build_ping_reply(rxBuff.data);
rxBuff.length = rxBuff.length - 4;
/* Send back an ICMP echo reply frame */
ENET_DRV_SendFrame(INST_ETHERNET1, 0U, &rxBuff, NULL);
}
ENET_DRV_ProvideRxBuff(INST_ETHERNET1, ring, &rxBuff);
stat = ENET_DRV_ReadFrame(INST_ETHERNET1, ring, &rxBuff, NULL);
}
}
}
/*!
\brief The main function for the project.
\details The startup initialization sequence is the following:
* - startup asm routine
* - main()
*/
int main(void)
{
/* Write your local variable definition here */
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
#ifdef PEX_RTOS_INIT
PEX_RTOS_INIT(); /* Initialization of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of Processor Expert internal initialization. ***/
/* Write your code here */
/* Initialize and configure clocks
* - see clock manager component for details
*/
CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
ENET_DRV_Init(INST_ETHERNET1, ðernet1_State, ðernet1_InitConfig0, ethernet1_buffConfigArr0, ethernet1_MacAddr);
while(1)
{
/* Insert a small delay to make the blinking visible */
delay(720000);
/* Toggle output value LED */
PINS_DRV_TogglePins(GPIO_PORT, 1 << LED);
}
/*** Don't write any code pass this line, or it will be deleted during code generation. ***/
/*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/
#ifdef PEX_RTOS_START
PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of RTOS startup code. ***/
/*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
for(;;) {
if(exit_code != 0) {
break;
}
}
return exit_code;
/*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
/* END main */
/*!
** @}
*/
/*
** ###################################################################
**
** This file was created by Processor Expert 10.1 [05.21]
** for the NXP S32R series of microcontrollers.
**
** ###################################################################
*/
Best,
Hadi