electroRF
Member
Hi,
I'm running the following application on AM335X (ARM), and getting Segmentation Fault at run-time on the line :
Here is the simple program itself:
Do you have an idea why I get this Segmentation Fault?
Thank you very much.
I'm running the following application on AM335X (ARM), and getting Segmentation Fault at run-time on the line :
C:
value = *(reg); // Segmentation Fault here!
Here is the simple program itself:
C:
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#define GPIO1_BASE 0x4804C000 // Start Address
#define GPIO_OE 0x0134 // Offset
#define GPIO_DATAOUT 0x013C // Offset
#define GPIO1_16 16
int main(int argc, char** argv)
{
volatile unsigned int* reg;
unsigned int value;
/* LED Setup and Turn-on */
reg = (volatile unsigned int*)(GPIO1_BASE + GPIO_OE);
value = *(reg); // Segmentation Fault here!
value &= ~(1 << GPIO1_16);
*(reg) = value;
reg = (volatile unsigned int*)(GPIO5_BASE + GPIO_DATAOUT);
value = *(reg);
value |= (1 << GPIO1_16);
*(reg) = value;
return 0;
}
Do you have an idea why I get this Segmentation Fault?
Thank you very much.