SparkFun Forums 

Where electronics enthusiasts find answers.

Everything ARM and LPC
By mai_tb
#93530
hi every body,
this is my first time i use arm processor
i bought a board from olimex SAM9-L9260 I read the examples from olimex websites but it doesn't run on the board
it has linux on it and i try to write a code in c then in compile it by the cross compilers and by the usb i copy it to the board but the code doesn't run it give segmentation fault
what i tried to do is to turn on a led in portb
here is the code and plz tell me my fault

include "AT91SAM9260.h"
//#include "AT91SAM9260_inc.h"
#include "test.h"

#include "bits.h"
#include "lib_AT91SAM9260.h"



AT91PS_PIO p_pPioA = AT91C_BASE_PIOA;
AT91PS_PIO p_pPioB = AT91C_BASE_PIOB;
AT91PS_PIO p_pPioC = AT91C_BASE_PIOC;
AT91PS_PMC p_pPMC = AT91C_BASE_PMC;
AT91PS_RTTC p_pRTTC = AT91C_BASE_RTTC;



void delay(unsigned long a)
{
while(--a!=0);


}

int main()
{

bool set_port=false;

p_pPMC->PMC_PCER = 1 << AT91C_ID_PIOB;

//p_pPioA->PIO_PPUDR = 0xffffffff; // Disable Pull-up resistor
p_pPioB->PIO_PPUDR = 0xffffffff; // Disable Pull-up resistor
// p_pPioC->PIO_PPUDR = 0xffffffff; // Disable Pull-up resistor

//LED STAT
p_pPioB->PIO_PER |= BIT10; //Enable PA6
p_pPioB->PIO_OER |= BIT10; //Configure in Output

while(true)
{

if(set_port==false)
{ p_pPioB->PIO_SODR |= BIT10; //set reg to 1
set_port=true;

}

else
{
p_pPioB->PIO_CODR |= BIT10;
set_port=false;

}

delay(500000);



}

return 0;

}


this code i compile it by the cross compiler and put it on board
the compilation succeed but when i run it it give me segmentation fault



plz any one tell me how to turn on a led
By bugtraker
#94321
On linux when you get 'segmentation fault' it could be a stackovf, or the user that tries to run the program does not have rights to do so.