Author Topic: need help to setup C::B for programming ARM  (Read 22510 times)

Offline trilog

  • Single posting newcomer
  • *
  • Posts: 2
need help to setup C::B for programming ARM
« on: April 14, 2010, 07:40:24 am »
hi,

I am new to codeblocks.

I need  help to setup codeblock for programming lpc 21xx.

I am using c::b svn 6181 ,which has arm template >(olimex-lpc 213x)
I tried with both  GNU ARM GCC 4.1.1 compiler & GNU ARM GCC 3.4.3.
After build ,following message is shown ....
***********************************************************
-------------- Build: default in test ---------------

Linking console executable: default\test.elf
default\src\vectors.o(.text+0x114):src/vectors.S:260: undefined reference to `IrqInit'
/cygdrive/c/Program Files/GNUARM/bin/../lib/gcc/arm-elf/3.4.3/../../../../arm-elf/lib/crt0.o(.text+0xf4):../../../../../../newlib-1.12.0/newlib/libc/sys/arm/crt0.S:206: undefined reference to `__bss_start__'
/cygdrive/c/Program Files/GNUARM/bin/../lib/gcc/arm-elf/3.4.3/../../../../arm-elf/lib/crt0.o(.text+0xf8):../../../../../../newlib-1.12.0/newlib/libc/sys/arm/crt0.S:206: undefined reference to `__bss_end__'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
3 errors, 0 warnings
***********************************************************

why 3 errors?? what i want to do to fix this errors??
please help me..........

Warm regards,
Trilog
« Last Edit: April 14, 2010, 07:44:40 am by trilog »

Offline huuhoang1712

  • Single posting newcomer
  • *
  • Posts: 2
  • HUUHOANG
Re: need help to setup C::B for programming ARM
« Reply #1 on: October 06, 2010, 05:34:35 am »
I also encountered similar situations. you please help us
Thanks and Best Regards,<br />HuuHoang Nguyen<br />email: huuhoang_1712@gmail.com<br />cell: +84(0)909526352

Offline dasfoo

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: need help to setup C::B for programming ARM
« Reply #2 on: October 07, 2010, 01:44:13 am »
I also encountered similar situations. you please help us

I'd suggest you look here.

http://www.yagarto.de/

Also sparkfun.org has forums related to ARM.

Generally I think for ARM7/ARM9 development you're better off for now using Eclipse for the IDE/Debugger.  Even though Eclipse blows.  You can use CodeBlock for editing and compiling for ARM7 with the yagarto tool chain.  But I don't think debugging is quite there yet.


Offline tanq

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: need help to setup C::B for programming ARM
« Reply #3 on: October 22, 2010, 03:13:27 pm »
__bss_start__ and __bss_end__ define the start and the end of the bss section respectively. That section contains uninitialized data and should be filled wth zeros when program starts.
Typical startup code for ARM platform looks like this:

Code
// section bounds defined by linker script
extern unsigned char _text_start;
extern unsigned char _text_end;
extern unsigned char _data_start;
extern unsigned char _data_end;
extern unsigned char _bss_start;
extern unsigned char _bss_end;

extern void main(void);
extern void SystemInit(void);

void boot_entry(void)
{
register unsigned char *src, *dst;

//set up PLL
SystemInit();

// Copy data from flash to ram
src = &_text_end;
dst = &_data_start;
while(dst < &_data_end) *dst++ = *src++;

// Initialize bss
dst = &_bss_start;
while(dst < &_bss_end) *dst++ = 0;

#ifdef USE_CRT
crt_init();
__libc_init_array();
main();
//__libc_fini_array();
#else
main();
#endif
while(1);
}

Magic names like " _text_start" defined inside linker script. There's example script for LPC1114. LPC21xx differs by memory sizes and ram base address.
Code
MEMORY
{
flash(rx): ORIGIN = 0x00000000, LENGTH = 32K
sram(rwx): ORIGIN = 0x10000000, LENGTH = 8K
}

sram_top = ORIGIN(sram) + LENGTH(sram);
ENTRY(boot_entry)

SECTIONS
{
.text :
{
        _text_start = .;
/* irq vectors table */
KEEP(*(.irq_vectors))
/* static constructors */
__preinit_array_start = .;
        KEEP(*(.preinit_array*))
        __preinit_array_end = .;
        __init_array_start = .;
        KEEP(*(.init_array*))
        __init_array_end = .;
        /* code */
        *(.text*)
        *(.rodata*)
        *(.glue_7)
        *(.glue_7t)
        *(.gnu*)
        *(.gcc*)
/* static destructors */
        /*__fini_array_start = .;
        KEEP(*(.fini_array*))
        __fini_array_end = .;*/
} > flash

/* exception handling */
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } > flash
__exidx_start = .;
.ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } > flash
__exidx_end = .;

_text_end = .;

.data : AT (__exidx_end)
{
_data_start = .;
*(vtable)
*(.data*)
_data_end = .;
} > sram

.bss :
{
_bss_start = .;
*(.bss*)
*(COMMON)
_bss_end = .;
} > sram

end = .;

/* For GDB compatibility we decrease the top with 16 bytes */
stack_entry = sram_top - 16;
}

In that script expression "." means current address. Expression _data_start = .; defines new symbol "_data_start" and assigns current address to it.
If you neeed some other symbol names, just add them to the script

Offline MasterAlexei

  • Multiple posting newcomer
  • *
  • Posts: 83
    • Fun electronic
Re: need help to setup C::B for programming ARM
« Reply #4 on: October 23, 2010, 06:16:23 pm »
Hello there,

I did have the same errors in my project. But I did make the project in CB and used the sources from Atmel examples.
The Atmel examples with delivered makefile are compilled without errors.
The difference is in a linker parameters
-nostartfiles
-Wl,--gc-sections

I did added thouse to the "Other linker options" in CB, and my project compilled successfull.

But now I have other problem, how to start debugger for my AT91SAM7SE256 chip via OOCD link. I am searching further.