EmbDev.net

Forum: ARM programming with GCC/GNU tools Linker File , Make File with C++ Support for AT91SAMX256


Author: Flying Arm (flying)
Posted on:

Rate this post
0 useful
not useful
Hi

I am very new to Microcontroller programming.

I am using Olimex board with AT91SAMX256 .

Does anyone have any idea where i can get Linker file and make files
with C++ support.

I am tyring seriously since few days to get rid off this error :

' No memory section defined for loadable section'.

I took some sample linker scripts with c++ support from WinArm projects
page but i dont know how to change memory locations according to my
target board or configure things to get started with c++ programming.

I tried almost all possibilities with different linker scripts.

The board works fine when i program with c.

But i must do my program now in c++.

So please help me out.

Have a nice day ahead.

Regards
Rajitha

Author: Jim Kaz (ancaritha)
Posted on:

Rate this post
0 useful
not useful
Rajitha Dandu wrote:
> The board works fine when i program with c.
>
> But i must do my program now in c++.


If your program works in C, but not C++ theres also the possibility that
there is an error with your makefile.  Post your entire make file,
linker script, and the entire output of the error you are getting.

Author: Flying Arm (flying)
Posted on:

Rate this post
0 useful
not useful
Jim Kaz wrote:
> Rajitha Dandu wrote:
>> The board works fine when i program with c.
>>
>> But i must do my program now in c++.
>
>
> If your program works in C, but not C++ theres also the possibility that
> there is an error with your makefile.  Post your entire make file,
> linker script, and the entire output of the error you are getting.

Thank you for your response.

Here are the files which i am using

               Makefile


#FLASH_TOOL = UVISION
FLASH_TOOL = OPENOCD

# MCU name and submodel
MCU      = arm7tdmi
SUBMDL   = AT91SAM7X256

USE_THUMB_MODE = YES
#USE_THUMB_MODE = NO

## Create ROM-Image (final)
RUN_MODE=ROM_RUN
## Create RAM-Image (debugging)
##( not used: example does not fit in AT91SAM7S64 RAM )
#RUN_MODE=RAM_RUN

## Exception-Vector placement only supported for "ROM_RUN"
## (placement settings ignored when using "RAM_RUN")
## - Exception vectors in ROM:
#VECTOR_LOCATION=VECTORS_IN_ROM
## - Exception vectors in RAM:
VECTOR_LOCATION=VECTORS_IN_RAM

# Target file name (without extension).
TARGET = main

# List C source files here. (C dependencies are automatically
generated.)
# use file-extension c for "c-only"-files
#SRC = dbgu.c
#SRC += syscalls.c
#SRC += swi_handler_user.c
# SRC += rprintf.c

# List C source files here which must be compiled in ARM-Mode.
# use file-extension c for "c-only"-files
#SRCARM  = common/Cstartup_SAM7.c

# List C++ source files here.
# use file-extension cpp for C++-files (use extension .cpp)
CPPSRC = $(TARGET).cpp

# List C++ source files here which must be compiled in ARM-Mode.
# use file-extension cpp for C++-files (use extension .cpp)
CPPSRCARM =

# List Assembler source files here.
# Make them always end in a capital .S.  Files ending in a lowercase .s
# will not be considered source files but generated files (assembler
# output from the compiler), and will be deleted upon "make clean"!
# Even though the DOS/Win* filesystem matches both .s and .S the same,
# it will preserve the spelling of the filenames, and gcc itself does
# care about how the name is spelled on its command-line.
ASRC =

# List Assembler source files here which must be assembled in ARM-Mode..
ASRCARM  = Cstartup.S
ASRCARM += swi_handler.S

## Output format. (can be ihex or binary)
## (binary i.e. for openocd and SAM-BA, hex i.e. for lpc21isp and
uVision)
#FORMAT = ihex
FORMAT = binary

# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
#OPT = 0

# Debugging format.
# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
# AVR (extended) COFF requires stabs, plus an avr-objcopy run.
#DEBUG = stabs
DEBUG = dwarf-2

# List any extra directories to look for include files here.
#     Each directory must be seperated by a space.
#EXTRAINCDIRS = ./common

# List any extra directories to look for library files here.
#     Each directory must be seperated by a space.
#EXTRA_LIBDIRS = ../arm7_efsl_0_2_4
EXTRA_LIBDIRS =

## Using the Atmel AT91_lib produces warning with
## the default warning-levels.
## yes - disable these warnings; no - keep default settings
AT91LIBNOWARN = yes
#AT91LIBNOWARN = no

# Compiler flag to set the C Standard level.
# c89   - "ANSI" C
# gnu89 - c89 plus GCC extensions
# c99   - ISO C99 standard (not yet fully implemented)
# gnu99 - c99 plus GCC extensions
CSTANDARD = -std=gnu99

# Place -D or -U options for C here
CDEFS =  -D$(RUN_MODE)

# Place -I options here
CINCS =

# Place -D or -U options for ASM here
ADEFS =  -D$(RUN_MODE)

ifdef VECTOR_LOCATION
CDEFS += -D$(VECTOR_LOCATION)
ADEFS += -D$(VECTOR_LOCATION)
endif

CDEFS += -D__WinARM__
ADEFS += -D__WinARM__

# Compiler flags.

ifeq ($(USE_THUMB_MODE),YES)
THUMB    = -mthumb
THUMB_IW = -mthumb-interwork
else
THUMB    =
THUMB_IW =
endif

#  -g*:          generate debugging information
#  -O*:          optimization level
#  -f...:        tuning, see GCC manual and avr-libc documentation
#  -Wall...:     warning level
#  -Wa,...:      tell GCC to pass this to the assembler.
#    -adhlns...: create assembler listing
#
# Flags for C and C++ (arm-elf-gcc/arm-elf-g++)
CFLAGS = -g$(DEBUG)
CFLAGS += $(CDEFS) $(CINCS)
CFLAGS += -O$(OPT)
CFLAGS += -ffunction-sections -fdata-sections
CFLAGS += -Wall -Wcast-align -Wimplicit
CFLAGS += -Wpointer-arith -Wswitch
CFLAGS += -Wredundant-decls -Wreturn-type -Wshadow -Wunused
CFLAGS += -Wa,-adhlns=$(subst $(suffix $<),.lst,$<)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))

# flags only for C
CONLYFLAGS += -Wnested-externs
CONLYFLAGS += $(CSTANDARD)

ifneq ($(AT91LIBNOWARN),yes)
#AT91-lib warnings with:
CFLAGS += -Wcast-qual
CONLYFLAGS += -Wmissing-prototypes
CONLYFLAGS += -Wstrict-prototypes
CONLYFLAGS += -Wmissing-declarations
endif

# flags only for C++ (arm-elf-g++)
CPPFLAGS = -fno-rtti -fno-exceptions

# Assembler flags.
#  -Wa,...:    tell GCC to pass this to the assembler.
#  -ahlns:     create listing
#  -g$(DEBUG): have the assembler create line number information
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:.S=.lst),--g$(DEBUG)


#Additional libraries.

# Extra libraries
#    Each library-name must be seperated by a space.
#    To add libxyz.a, libabc.a and libefsl.a:
#    EXTRA_LIBS = xyz abc efsl
#EXTRA_LIBS = efsl
EXTRA_LIBS =

#Support for newlibc-lpc (file: libnewlibc-lpc.a)
#NEWLIBLPC = -lnewlib-lpc

MATH_LIB = -lm

CPLUSPLUS_LIB = -lstdc++

# Linker flags.
#  -Wl,...:     tell GCC to pass this to linker.
#    -Map:      create map file
#    --cref:    add cross reference to  map file
LDFLAGS = -nostartfiles -Wl,-Map=$(TARGET).map,--cref,--gc-sections
LDFLAGS += -lc
LDFLAGS += $(NEWLIBLPC) $(MATH_LIB)
LDFLAGS += -lc -lgcc
LDFLAGS += $(CPLUSPLUS_LIB)
LDFLAGS += $(patsubst %,-L%,$(EXTRA_LIBDIRS))
LDFLAGS += $(patsubst %,-l%,$(EXTRA_LIBS))

# Set Linker-Script Depending On Selected Memory and Controller
ifeq ($(RUN_MODE),RAM_RUN)
LDFLAGS +=-T./$(SUBMDL)-RAM.ld
else
LDFLAGS +=-T./$(SUBMDL)-ROM.ld
endif


#
------------------------------------------------------------------------ 
---
# Flash-Programming support using lpc21isp by Martin Maurer
# only for Philips LPC and Analog ADuC ARMs
#
# Settings and variables:
#LPC21ISP = lpc21isp
#LPC21ISP = lpc21isp
#LPC21ISP_PORT = com1
#LPC21ISP_BAUD = 38400
#LPC21ISP_XTAL = 12000
#LPC21ISP_FLASHFILE = $(TARGET).hex
# verbose output:
#LPC21ISP_DEBUG = -debug
# enter bootloader via RS232 DTR/RTS (only if hardware supports this
# feature - see Philips AppNote):
#LPC21ISP_CONTROL = -control
#
------------------------------------------------------------------------ 
---


# Define directories, if needed.
## DIRARM = c:/WinARM/
## DIRARMBIN = $(DIRAVR)/bin/
## DIRAVRUTILS = $(DIRAVR)/utils/bin/

# Define programs and commands.
SHELL = sh
CC = arm-elf-gcc
CPP = arm-elf-g++
OBJCOPY = arm-elf-objcopy
OBJDUMP = arm-elf-objdump
SIZE = arm-elf-size
NM = arm-elf-nm
REMOVE = rm -f
COPY = cp

# Define Messages
# English
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = "-------- begin (mode: $(RUN_MODE)) --------"
MSG_END = --------  end  --------
MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_FLASH = Creating load file for Flash:
MSG_EXTENDED_LISTING = Creating Extended Listing:
MSG_SYMBOL_TABLE = Creating Symbol Table:
MSG_LINKING = Linking:
MSG_COMPILING = Compiling C:
MSG_COMPILING_ARM = "Compiling C (ARM-only):"
MSG_COMPILINGCPP = Compiling C++:
MSG_COMPILINGCPP_ARM = "Compiling C++ (ARM-only):"
MSG_ASSEMBLING = Assembling:
MSG_ASSEMBLING_ARM = "Assembling (ARM-only):"
MSG_CLEANING = Cleaning project:
MSG_FORMATERROR = Can not handle output-format
MSG_LPC21_RESETREMINDER = You may have to bring the target in
bootloader-mode now.

# Define all object files.
COBJ      = $(SRC:.c=.o)
AOBJ      = $(ASRC:.S=.o)
COBJARM   = $(SRCARM:.c=.o)
AOBJARM   = $(ASRCARM:.S=.o)
CPPOBJ    = $(CPPSRC:.cpp=.o)
CPPOBJARM = $(CPPSRCARM:.cpp=.o)

# Define all listing files.
LST = $(ASRC:.S=.lst) $(ASRCARM:.S=.lst) $(SRC:.c=.lst)
$(SRCARM:.c=.lst)
LST += $(CPPSRC:.cpp=.lst) $(CPPSRCARM:.cpp=.lst)

# Compiler flags to generate dependency files.
### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d
GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d

# Combine all necessary flags and optional flags.
# Add target processor to flags.
ALL_CFLAGS  = -mcpu=$(MCU) $(THUMB_IW) -I. $(CFLAGS) $(GENDEPFLAGS)
ALL_ASFLAGS = -mcpu=$(MCU) $(THUMB_IW) -I. -x assembler-with-cpp
$(ASFLAGS)


# Default target.
all: begin gccversion sizebefore build sizeafter finished end

ifeq ($(FORMAT),ihex)
build: elf hex lss sym
hex: $(TARGET).hex
IMGEXT=hex
else
ifeq ($(FORMAT),binary)
build: elf bin lss sym
bin: $(TARGET).bin
IMGEXT=bin
else
$(error "$(MSG_FORMATERROR) $(FORMAT)")
endif
endif

elf: $(TARGET).elf
lss: $(TARGET).lss
sym: $(TARGET).sym

# Eye candy.
begin:
  @echo
  @echo $(MSG_BEGIN)

finished:
  @echo $(MSG_ERRORS_NONE)

end:
  @echo $(MSG_END)
  @echo


# Display size of file.
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
ELFSIZE = $(SIZE) -A $(TARGET).elf
sizebefore:
  @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE);
$(ELFSIZE); echo; fi

sizeafter:
  @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER);
$(ELFSIZE); echo; fi


# Display compiler version information.
gccversion :
  @$(CPP) --version


ifeq ($(FLASH_TOOL),OPENOCD)
# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs
cfg and "reset-script".
program: $(TARGET).$(IMGEXT)
  @echo
  @echo "Programming with OPENOCD"
  CC:\Program Files\openocd-2006re115\bin\openocd-ftd2xx.exe -f
at91sam7x256-armusbocd-flash-program.cfg
#else
# Program the device.  - lpc21isp will not work for SAM7
#program: $(TARGET).$(IMGEXT)
#  @echo
#  @echo $(MSG_LPC21_RESETREMINDER)
#  $(LPC21ISP) $(LPC21ISP_OPTIONS) $(LPC21ISP_DEBUG)
$(LPC21ISP_FLASHFILE) $(LPC21ISP_PORT) $(LPC21ISP_BAUD) $(LPC21ISP_XTAL)
#endif
endif


# Create final output file (.hex) from ELF output file.
%.hex: %.elf
  @echo
  @echo $(MSG_FLASH) $@
  $(OBJCOPY) -O $(FORMAT) $< $@

# Create final output file (.bin) from ELF output file.
%.bin: %.elf
  @echo
  @echo $(MSG_FLASH) $@
  $(OBJCOPY) -O $(FORMAT) $< $@


# Create extended listing file from ELF output file.
# testing: option -C
%.lss: %.elf
  @echo
  @echo $(MSG_EXTENDED_LISTING) $@
  $(OBJDUMP) -h -S -C $< > $@


# Create a symbol table from ELF output file.
%.sym: %.elf
  @echo
  @echo $(MSG_SYMBOL_TABLE) $@
  $(NM) -n $< > $@


# Link: create ELF output file from object files.
.SECONDARY : $(TARGET).elf
.PRECIOUS : $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM)
%.elf:  $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ) $(CPPOBJ) $(CPPOBJARM)
  @echo
  @echo $(MSG_LINKING) $@
  $(CC) $(THUMB) $(ALL_CFLAGS) $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ)
$(CPPOBJ) $(CPPOBJARM) --output $@ $(LDFLAGS)
#  $(CPP) $(THUMB) $(ALL_CFLAGS) $(AOBJARM) $(AOBJ) $(COBJARM) $(COBJ)
$(CPPOBJ) $(CPPOBJARM) --output $@ $(LDFLAGS)

# Compile: create object files from C source files. ARM/Thumb
$(COBJ) : %.o : %.c
  @echo
  @echo $(MSG_COMPILING) $<
  $(CC) -c $(THUMB) $(ALL_CFLAGS) $(CONLYFLAGS) $< -o $@

# Compile: create object files from C source files. ARM-only
$(COBJARM) : %.o : %.c
  @echo
  @echo $(MSG_COMPILING_ARM) $<
  $(CC) -c $(ALL_CFLAGS) $(CONLYFLAGS) $< -o $@

# Compile: create object files from C++ source files. ARM/Thumb
$(CPPOBJ) : %.o : %.cpp
  @echo
  @echo $(MSG_COMPILINGCPP) $<
  $(CPP) -c $(THUMB) $(ALL_CFLAGS) $(CPPFLAGS) $< -o $@

# Compile: create object files from C++ source files. ARM-only
$(CPPOBJARM) : %.o : %.cpp
  @echo
  @echo $(MSG_COMPILINGCPP_ARM) $<
  $(CPP) -c $(ALL_CFLAGS) $(CPPFLAGS) $< -o $@


# Compile: create assembler files from C source files. ARM/Thumb
## does not work - TODO - hints welcome
##$(COBJ) : %.s : %.c
##  $(CC) $(THUMB) -S $(ALL_CFLAGS) $< -o $@


# Assemble: create object files from assembler source files. ARM/Thumb
$(AOBJ) : %.o : %.S
  @echo
  @echo $(MSG_ASSEMBLING) $<
  $(CC) -c $(THUMB) $(ALL_ASFLAGS) $< -o $@


# Assemble: create object files from assembler source files. ARM-only
$(AOBJARM) : %.o : %.S
  @echo
  @echo $(MSG_ASSEMBLING_ARM) $<
  $(CC) -c $(ALL_ASFLAGS) $< -o $@


# Target: clean project.
clean: begin clean_list finished end


clean_list :
  @echo
  @echo $(MSG_CLEANING)
  $(REMOVE) ../Common_WinARM/$(TARGET).hex
  $(REMOVE) $(TARGET).hex
  $(REMOVE) $(TARGET).bin
  $(REMOVE) $(TARGET).obj
  $(REMOVE) $(TARGET).elf
  $(REMOVE) $(TARGET).map
  $(REMOVE) $(TARGET).obj
  $(REMOVE) $(TARGET).a90
  $(REMOVE) $(TARGET).sym
  $(REMOVE) $(TARGET).lnk
  $(REMOVE) $(TARGET).lss
  $(REMOVE) $(COBJ)
  $(REMOVE) $(CPPOBJ)
  $(REMOVE) $(AOBJ)
  $(REMOVE) $(COBJARM)
  $(REMOVE) $(CPPOBJARM)
  $(REMOVE) $(AOBJARM)
  $(REMOVE) $(LST)
  $(REMOVE) $(SRC:.c=.s)
  $(REMOVE) $(SRC:.c=.d)
  $(REMOVE) $(SRCARM:.c=.s)
  $(REMOVE) $(SRCARM:.c=.d)
  $(REMOVE) $(CPPSRC:.cpp=.s)
  $(REMOVE) $(CPPSRC:.cpp=.d)
  $(REMOVE) $(CPPSRCARM:.cpp=.s)
  $(REMOVE) $(CPPSRCARM:.cpp=.d)
  $(REMOVE) .dep/*


# Include the dependency files.
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)


# Listing of phony targets.
.PHONY : all begin finish end sizebefore sizeafter gccversion \
build elf hex bin lss sym clean clean_list program


 RAM lINKER SCRIPT
/*---------------------------------------------------------------------- 
-----*/
/*- File source          : GCC_RAM.ld
*/
/*- Object               : Linker Script File for RAM Workspace
*/
/*- Compilation flag     : None
*/
/*-
*/
/*- 1.0 11/Mar/05 JPP    : Creation S256
*/
/*---------------------------------------------------------------------- 
-----*/

/*
   24-02-2006  Ewout Boks. Adapted from AT91SAM7S64-RAM.ld script by M.
Thomas.
   - Changed the memory sections to model the AT91SAM7S256 .
   - modified the region where the .text section is loaded to DATA
   - tested succesfully with AT91SAM7 GPIO Example and PEEDI debugger
     on AT91SAM7S-EK equipped with AT91SAM7S256
*/

/* Memory Definitions */

MEMORY
{
  FLASH (rx) : ORIGIN = 0x00100000, LENGTH = 0x00040000
  DATA (rw)  : ORIGIN = 0x00200000, LENGTH = 0x00010000
  STACK (rw) : ORIGIN = 0x00210000, LENGTH = 0x00000000
}


/* Section Definitions */

SECTIONS
{
  /* first section is .text which is used for code */
  . = 0x0000000;
  .text : { *Cstartup.o (.text) }>DATA =0
  .text :
  {
    *(.text)                   /* remaining code */

    *(.glue_7t) *(.glue_7)

  } >DATA
  . = ALIGN(4);

  /* .rodata section which is used for read-only data (constants) */

  .rodata :
  {
    *(.rodata)
  } >DATA

  . = ALIGN(4);

  _etext = . ;
  PROVIDE (etext = .);

  /* .data section which is used for initialized data */

  .data : AT (_etext)
  {
    _data = . ;
    *(.data)
    SORT(CONSTRUCTORS)
  } >DATA
  . = ALIGN(4);

  _edata = . ;
   PROVIDE (edata = .);

  /* .bss section which is used for uninitialized data */

  .bss :
  {
    __bss_start = . ;
    _bss_start_ = . ;
    *(.bss)
    *(COMMON)
  }
  . = ALIGN(4);
  _bss_end_ = . ;
  _bss_end_ = . ;
  _end = .;
  PROVIDE (end = .);

    . = ALIGN(4);
   .int_data :
   {
   *(.internal_ram_top)
   }> STACK



  /* Stabs debugging sections.  */
  .stab          0 : { *(.stab) }
  .stabstr       0 : { *(.stabstr) }
  .stab.excl     0 : { *(.stab.excl) }
  .stab.exclstr  0 : { *(.stab.exclstr) }
  .stab.index    0 : { *(.stab.index) }
  .stab.indexstr 0 : { *(.stab.indexstr) }
  .comment       0 : { *(.comment) }
  /* DWARF debug sections.
     Symbols in the DWARF debugging sections are relative to the
beginning
     of the section so we begin them at 0.  */
  /* DWARF 1 */
  .debug          0 : { *(.debug) }
  .line           0 : { *(.line) }
  /* GNU DWARF 1 extensions */
  .debug_srcinfo  0 : { *(.debug_srcinfo) }
  .debug_sfnames  0 : { *(.debug_sfnames) }
  /* DWARF 1.1 and DWARF 2 */
  .debug_aranges  0 : { *(.debug_aranges) }
  .debug_pubnames 0 : { *(.debug_pubnames) }
  /* DWARF 2 */
  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
  .debug_abbrev   0 : { *(.debug_abbrev) }
  .debug_line     0 : { *(.debug_line) }
  .debug_frame    0 : { *(.debug_frame) }
  .debug_str      0 : { *(.debug_str) }
  .debug_loc      0 : { *(.debug_loc) }
  .debug_macinfo  0 : { *(.debug_macinfo) }
  /* SGI/MIPS DWARF 2 extensions */
  .debug_weaknames 0 : { *(.debug_weaknames) }
  .debug_funcnames 0 : { *(.debug_funcnames) }
  .debug_typenames 0 : { *(.debug_typenames) }
  .debug_varnames  0 : { *(.debug_varnames) }

}

ROM LINKER SCRIPT
/*---------------------------------------------------------------------- 
-----*/
/*- File source          : GCC_FLASH.ld
*/
/*- Object               : Linker Script File for Flash Workspace
*/
/*- Compilation flag     : None
*/
/*-
*/
/*- 1.0 11/Mar/05 JPP    : Creation S256
*/
/*---------------------------------------------------------------------- 
-----*/

/*
   24-02-2006  Ewout Boks. Adapted from AT91SAM7S64-RAM.ld script by M.
Thomas.
   - Changed the memory sections to model the AT91SAM7S256 .
   - tested succesfully with AT91SAM7 GPIO Example and PEEDI debugger
     on AT91SAM7S-EK equipped with AT91SAM7S256
*/

/* Memory Definitions */

MEMORY
{
  FLASH (rx) : ORIGIN = 0x00100000, LENGTH = 0x00040000
  DATA (rw)  : ORIGIN = 0x00200000, LENGTH = 0x00010000
  STACK (rw) : ORIGIN = 0x00210000, LENGTH = 0x00000000
}


/* Section Definitions */

SECTIONS
{
  /* first section is .text which is used for code */
  . = 0x0000000;
  .text : { *Cstartup.o (.text) }>FLASH =0
  .text :
  {
    *(.text)                   /* remaining code */

    *(.glue_7t) *(.glue_7)

  } >FLASH

  . = ALIGN(4);

  /* .rodata section which is used for read-only data (constants) */

  .rodata :
  {
    *(.rodata)
  } >FLASH

  . = ALIGN(4);

  _etext = . ;
  PROVIDE (etext = .);

  /* .data section which is used for initialized data */

  .data : AT (_etext)
  {
    _data = . ;
    *(.data)
    SORT(CONSTRUCTORS)
  } >DATA
  . = ALIGN(4);

  _edata = . ;
   PROVIDE (edata = .);

  /* .bss section which is used for uninitialized data */

  .bss :
  {
    __bss_start = . ;
    _bss_start_ = . ;
    *(.bss)
    *(COMMON)
  }
  . = ALIGN(4);
  _bss_end_ = . ;
  _bss_end_ = . ;
  _end = .;
  PROVIDE (end = .);

    . = ALIGN(4);
   .int_data :
   {
   *(.internal_ram_top)
   }> STACK



  /* Stabs debugging sections.  */
  .stab          0 : { *(.stab) }
  .stabstr       0 : { *(.stabstr) }
  .stab.excl     0 : { *(.stab.excl) }
  .stab.exclstr  0 : { *(.stab.exclstr) }
  .stab.index    0 : { *(.stab.index) }
  .stab.indexstr 0 : { *(.stab.indexstr) }
  .comment       0 : { *(.comment) }
  /* DWARF debug sections.
     Symbols in the DWARF debugging sections are relative to the
beginning
     of the section so we begin them at 0.  */
  /* DWARF 1 */
  .debug          0 : { *(.debug) }
  .line           0 : { *(.line) }
  /* GNU DWARF 1 extensions */
  .debug_srcinfo  0 : { *(.debug_srcinfo) }
  .debug_sfnames  0 : { *(.debug_sfnames) }
  /* DWARF 1.1 and DWARF 2 */
  .debug_aranges  0 : { *(.debug_aranges) }
  .debug_pubnames 0 : { *(.debug_pubnames) }
  /* DWARF 2 */
  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
  .debug_abbrev   0 : { *(.debug_abbrev) }
  .debug_line     0 : { *(.debug_line) }
  .debug_frame    0 : { *(.debug_frame) }
  .debug_str      0 : { *(.debug_str) }
  .debug_loc      0 : { *(.debug_loc) }
  .debug_macinfo  0 : { *(.debug_macinfo) }
  /* SGI/MIPS DWARF 2 extensions */
  .debug_weaknames 0 : { *(.debug_weaknames) }
  .debug_funcnames 0 : { *(.debug_funcnames) }
  .debug_typenames 0 : { *(.debug_typenames) }
  .debug_varnames  0 : { *(.debug_varnames) }

}

ERROR IS AS SHOWN BELOW

make -k all
C:\Program: C:\Program: No such file or directory
make: *** [begin] Error 127
arm-elf-g++ (GCC) 4.1.1
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

C:\Program: C:\Program: No such file or directory
make: *** [Cstartup.o] Error 127
C:\Program: C:\Program: No such file or directory
make: *** [swi_handler.o] Error 127
C:\Program: C:\Program: No such file or directory
make: *** [finished] Error 127
C:\Program: C:\Program: No such file or directory
make: *** [end] Error 127
make: Target `all' not remade because of errors.


I dont understand from where the c:\program command comes from , i dont
see any such thing in makefile.

I am trying to rectify this error since few days but nouse.

Please help me

Have a nice day ahead

Regards
Rajitha

Author: Jonathan Dumaresq (dumarjo)
Posted on:

Rate this post
0 useful
not useful
>
> make -k all
> C:\Program: C:\Program: No such file or directory
> make: *** [begin] Error 127
> arm-elf-g++ (GCC) 4.1.1
> Copyright (C) 2006 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is
> NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
> PURPOSE.
>
> C:\Program: C:\Program: No such file or directory
> make: *** [Cstartup.o] Error 127
> C:\Program: C:\Program: No such file or directory
> make: *** [swi_handler.o] Error 127
> C:\Program: C:\Program: No such file or directory
> make: *** [finished] Error 127
> C:\Program: C:\Program: No such file or directory
> make: *** [end] Error 127
> make: Target `all' not remade because of errors.
>
>
> I dont understand from where the c:\program command comes from , i dont
> see any such thing in makefile.
>
> I am trying to rectify this error since few days but nouse.
>
> Please help me
>
> Have a nice day ahead
>
> Regards
> Rajitha

in your make file change
SHELL = sh
for
SHELL = cmd

what is you version of make.exe ?

you should use the 3.81 from the yagarto or openocd toolchain.

regards

Jonathan

Author: Flying Arm (flying)
Posted on:

Rate this post
0 useful
not useful
Jonathan Dumarjo wrote:
>>
>> make -k all
>> C:\Program: C:\Program: No such file or directory
>> make: *** [begin] Error 127
>> arm-elf-g++ (GCC) 4.1.1
>> Copyright (C) 2006 Free Software Foundation, Inc.
>> This is free software; see the source for copying conditions.  There is
>> NO
>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
>> PURPOSE.
>>
>> C:\Program: C:\Program: No such file or directory
>> make: *** [Cstartup.o] Error 127
>> C:\Program: C:\Program: No such file or directory
>> make: *** [swi_handler.o] Error 127
>> C:\Program: C:\Program: No such file or directory
>> make: *** [finished] Error 127
>> C:\Program: C:\Program: No such file or directory
>> make: *** [end] Error 127
>> make: Target `all' not remade because of errors.
>>
>>
>> I dont understand from where the c:\program command comes from , i dont
>> see any such thing in makefile.
>>
>> I am trying to rectify this error since few days but nouse.
>>
>> Please help me
>>
>> Have a nice day ahead
>>
>> Regards
>> Rajitha
>
> in your make file change
> SHELL = sh
> for
> SHELL = cmd
>

 what is you version of make.exe ?
>
> you should use the 3.81 from the yagarto or openocd toolchain.
>
> regards
>
> Jonathan

Hi Thank you for your response.

I chaged to shell = cmd

and i have the make.exe from openocd and it is 3.81 .

Now the program gives error something like this:

Errors:

ld:cannot file -lnewlib-lpc
make: *** [sizebefore] error255

Warning:
c:\program
files\yagarto\bin\..\lib\gcc\arm-elf\4.1.1\..\..\..\..\arm-elf\bin\ld.ex 
e:AT91SAM7X256-ROM.ld
warning: memory region CODE not declared    test_c++  line 57
1175092730506  788

Console shows:

make -k all
The system cannot find the path specified.
ECHO is off.
"-------- begin (mode: ROM_RUN) --------"
arm-elf-gcc (GCC) 4.1.1
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

-f was unexpected at this time.
make: *** [sizebefore] Error 255
ECHO is off.
Linking: main.elf
arm-elf-gcc -mthumb -mcpu=arm7tdmi -mthumb-interwork -I. -gdwarf-2
-DROM_RUN -DVECTORS_IN_RAM -D__WinARM__  -Os -ffunction-sections
-fdata-sections -Wall -Wcast-align -Wimplicit  -Wpointer-arith -Wswitch
-Wredundant-decls -Wreturn-type -Wshadow -Wunused
-Wa,-adhlns=Cstartup.lst   -MD -MP -MF .dep/main.elf.d Cstartup.o
swi_handler.o     main.o   --output main.elf -nostartfiles
-Wl,-Map=main.map,--cref,--gc-sections -lc -lnewlib-lpc -lm -lc -lgcc
-lstdc++   -TAT91SAM7X256-ROM.ld
c:\program
files\yagarto\bin\..\lib\gcc\arm-elf\4.1.1\..\..\..\..\arm-elf\bin\ld.ex 
e:AT91SAM7X256-ROM.ld:57:
warning: memory region CODE not declared
c:\program
files\yagarto\bin\..\lib\gcc\arm-elf\4.1.1\..\..\..\..\arm-elf\bin\ld.ex 
e:
cannot find -lnewlib-lpc
collect2: ld returned 1 exit status
make: *** [main.elf] Error 1
-f was unexpected at this time.
make: *** [sizeafter] Error 255
Errors: none
--------  end  --------
ECHO is off.
make: Target `all' not remade because of errors.

Awaiting your response.

Have a nice evening ahead.

Regards
Rajitha

Author: Jonathan Dumaresq (dumarjo)
Posted on:

Rate this post
0 useful
not useful
>
> Hi Thank you for your response.
>
> I chaged to shell = cmd
>
> and i have the make.exe from openocd and it is 3.81 .
>
> Now the program gives error something like this:
>
> Errors:
>
> ld:cannot file -lnewlib-lpc
> make: *** [sizebefore] error255
>
> Warning:
> c:\program
> files\yagarto\bin\..\lib\gcc\arm-elf\4.1.1\..\..\..\..\arm-elf\bin\ld.ex 
e:AT91SAM7X256-ROM.ld
> warning: memory region CODE not declared    test_c++  line 57
> 1175092730506  788
>
> Console shows:
>
> make -k all
> The system cannot find the path specified.
> ECHO is off.


I realy think that you have something wrong with your system path. do
you type this from command prompt ? if not, try it. sometime you have
some other output that can help you to find the path that dosen't work.

regards

Jonathan

Author: Jonathan Dumaresq (dumarjo)
Posted on:

Rate this post
0 useful
not useful
>> ld:cannot file -lnewlib-lpc
>> make: *** [sizebefore] error255
>>

for the sizeof error, look in the make file, and remove the test to know
if a file exists, the -f xxxx, i don't know why but it dosen't work
anymore with shell = cmd.

regards

Jonathan

Author: Flying Arm (flying)
Posted on:

Rate this post
0 useful
not useful
Jonathan Dumarjo wrote:
>>> ld:cannot file -lnewlib-lpc
>>> make: *** [sizebefore] error255
>>>
>
> for the sizeof error, look in the make file, and remove the test to know
> if a file exists, the -f xxxx, i don't know why but it dosen't work
> anymore with shell = cmd.
>
> regards
>
> Jonathan

Hi  I am very thankful to you for your help so far.

I removed the -f xxx statements from makefile now there is no sizebefore
error but still the path not found error is there and also some other
errors are there.

I am using the files from sample projects of WinARM page ie., on this
page
http://www.siwawi.arubi.uni-kl.de/avr_projects/arm...

Do i need to change any linker scripts and assembler startup code .

I am using the linker scripts of AT91SAM7S256 , but i have the
AT91SAM7X256.

I checked the path in the command prompt everything is correct and i
also checked the path settings in the environment variables.



Please check this errors.

Errors:


undefined reference to `__FIRST_IN_RAM'  test_c++  Cstartup.S  line 342
1175177613674  865



undefined reference to `AT91F_LowLevelInit'  test_c++  Cstartup.S  line
342  1175177613674  866


undefined reference to `SWI_Handler_User'  test_c++  swi_handler.S  line
148  1175177613674  867


Warnings:

c:\program
files\yagarto\bin\..\lib\gcc\arm-elf\4.1.1\..\..\..\..\arm-elf\bin\ld.ex 
e:AT91SAM7X256-ROM.ld
warning: memory region CODE not declared    test_c++  line 57
1175177613674  864


Console shows:

make -k all
The system cannot find the path specified.
ECHO is off.
"-------- begin (mode: ROM_RUN) --------"
arm-elf-gcc (GCC) 4.1.1
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

ECHO is off.
Linking: main.elf
arm-elf-gcc -mthumb -mcpu=arm7tdmi -mthumb-interwork -I. -gdwarf-2
-DROM_RUN -DVECTORS_IN_RAM -D__WinARM__  -Os -ffunction-sections
-fdata-sections -Wall -Wcast-align -Wimplicit  -Wpointer-arith -Wswitch
-Wredundant-decls -Wreturn-type -Wshadow -Wunused
-Wa,-adhlns=Cstartup.lst   -MD -MP -MF .dep/main.elf.d Cstartup.o
swi_handler.o     main.o   --output main.elf -nostartfiles
-Wl,-Map=main.map,--cref,--gc-sections -lc -lc -lgcc  -lstdc++
-TAT91SAM7X256-ROM.ld
c:\program
files\yagarto\bin\..\lib\gcc\arm-elf\4.1.1\..\..\..\..\arm-elf\bin\ld.ex 
e:AT91SAM7X256-ROM.ld:57:
warning: memory region CODE not declared
Cstartup.o: In function `exit':
C:\EclipseWorkspace\test_c++/Cstartup.S:342: undefined reference to
`__FIRST_IN_RAM'
C:\EclipseWorkspace\test_c++/Cstartup.S:342: undefined reference to
`AT91F_LowLevelInit'
swi_handler.o: In function `EndofSWI':
C:\EclipseWorkspace\test_c++/swi_handler.S:148: undefined reference to
`SWI_Handler_User'
collect2: ld returned 1 exit status
make: *** [main.elf] Error 1
Errors: none
--------  end  --------
ECHO is off.
make: Target `all' not remade because of errors.

I am using this Yagarto Eclipse IDE for my thesis and right now i am
stuck up here since two weeks , and the time is running off, i need to
do programming only in c++ and i dont understand what to do at this
stage.

Awaiting your response.

Reagards
Rajitha

Author: Flying Arm (flying)
Posted on:

Rate this post
0 useful
not useful
Jonathan Dumarjo wrote:
>>> ld:cannot file -lnewlib-lpc
>>> make: *** [sizebefore] error255
>>>
>
> for the sizeof error, look in the make file, and remove the test to know
> if a file exists, the -f xxxx, i don't know why but it dosen't work
> anymore with shell = cmd.
>
> regards
>
> Jonathan

Hi

Now i have the following errors.

I think there is some problem with the Linker script memory regions and
ld.exe .

Please see this error:

Errors:

ld: internal error ../../binutils-2.17/ld/ldlang.c 4275    test_c++
line 0  1175180093750  880


Warnings:
c:\program
files\yagarto\bin\..\lib\gcc\arm-elf\4.1.1\..\..\..\..\arm-elf\bin\ld.ex 
e:AT91SAM7X256-ROM.ld
warning: memory region CODE not declared    test_c++  line 57
1175180093750  879

Console shows:

make -k all
The system cannot find the path specified.
ECHO is off.
"-------- begin (mode: ROM_RUN) --------"
arm-elf-gcc (GCC) 4.1.1
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

ECHO is off.
Linking: main.elf
arm-elf-gcc -mthumb -mcpu=arm7tdmi -mthumb-interwork -I. -gdwarf-2
-DROM_RUN -DVECTORS_IN_RAM -D__WinARM__  -Os -ffunction-sections
-fdata-sections -Wall -Wcast-align -Wimplicit  -Wpointer-arith -Wswitch
-Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-adhlns=crt.lst
-MD -MP -MF .dep/main.elf.d  crt.o    main.o   --output main.elf
-nostartfiles -Wl,-Map=main.map,--cref,--gc-sections -lc -lc -lgcc
-lstdc++   -TAT91SAM7X256-ROM.ld
c:\program
files\yagarto\bin\..\lib\gcc\arm-elf\4.1.1\..\..\..\..\arm-elf\bin\ld.ex 
e:AT91SAM7X256-ROM.ld:57:
warning: memory region CODE not declared
c:\program
files\yagarto\bin\..\lib\gcc\arm-elf\4.1.1\..\..\..\..\arm-elf\bin\ld.ex 
e:
internal error ../../binutils-2.17/ld/ldlang.c 4275
collect2: ld returned 1 exit status
make: *** [main.elf] Error 1
Errors: none
--------  end  --------
ECHO is off.
make: Target `all' not remade because of errors.

Please reply.

Regards
Rajitha

Author: Jonathan Dumaresq (dumarjo)
Posted on:

Rate this post
0 useful
not useful
Hi,

Ok have the sample compile here on my setup for a sam7x256. If you want
it, send
me an e-mail. I have not tested the program, i have just change the make
file and add a ld script for the 7x256.

jdumaresq @ cimeq.qc.ca

regards

Jonathan

Author: Flying Arm (flying)
Posted on:

Rate this post
0 useful
not useful
Jonathan Dumarjo wrote:
> Hi,
>
> Ok have the sample compile here on my setup for a sam7x256. If you want
> it, send
> me an e-mail. I have not tested the program, i have just change the make
> file and add a ld script for the 7x256.
>
> jdumaresq @ cimeq.qc.ca
>
> regards
>
> Jonathan

Hi

I am thankful to you for your intime response.

I like to have the makefiles and linker scripts with c++ support for
AT91SAM7X256.

I will be very thankful to you if you can provide me those.

Is this your email address : jdumaresq @ cimeq.qc.ca

I cant send any email to this adddress. It says invalid

Have a nice day ahead.

Regards
Rajitha

Author: Jonathan Dumaresq (dumarjo)
Posted on:

Rate this post
0 useful
not useful
> Hi
>
> I am thankful to you for your intime response.
>
> I like to have the makefiles and linker scripts with c++ support for
> AT91SAM7X256.
>
> I will be very thankful to you if you can provide me those.
>
> Is this your email address : jdumaresq @ cimeq.qc.ca
>
> I cant send any email to this adddress. It says invalid
>
> Have a nice day ahead.
>
> Regards
> Rajitha

remove the space between @ :P

Jonathan

Author: Flying Arm (flying)
Posted on:

Rate this post
0 useful
not useful
Jonathan Dumaresq wrote:
>> Hi
>>
>> I am thankful to you for your intime response.
>>
>> I like to have the makefiles and linker scripts with c++ support for
>> AT91SAM7X256.
>>
>> I will be very thankful to you if you can provide me those.
>>
>> Is this your email address : jdumaresq @ cimeq.qc.ca
>>
>> I cant send any email to this adddress. It says invalid
>>
>> Have a nice day ahead.
>>
>> Regards
>> Rajitha
>
> remove the space between @ :P
>
> Jonathan

Hi

The errors have been corrected now.

Thank you Jonathan for your support to solve this problem . It was
really a great help to me.

The problem was with the makefile and liker file.

In linker file we need to have memory region defined correctly for the
specific target we are using for differenrent regions.

There were some more errors and warnings like :

atal error: opening dependency file .dep/Cstartup_SAM7.o.d: No such file
or directory test_sam7x_c++/common Cstartup_SAM7.c line 86 1175273573862
1078

fatal error: opening dependency file .dep/dbgu.o.d: No such file or
directory test_sam7x_c++  dbgu.c line 115 1175273573878 1081

fatal error: opening dependency file .dep/main.o.d: No such file or
directory test_sam7x_c++ main.cpp line 233 1175273573878 1084

fatal error: opening dependency file .dep/swi_handler_user.o.d: No such
file or directory test_sam7x_c++ swi_handler_user.c line 17
1175273573878 1083

fatal error: opening dependency file .dep/syscalls.o.d: No such file or
directory test_sam7x_c++ syscalls.c line 159 1175273573878 1082

warning: implicit declaration of function 'siscanf' test_sam7x_c++
dbgu.c line 113 1175273573878 1079

warning: nested extern declaration of 'siscanf' test_sam7x_c++ dbgu.c
line 113 1175273573878 1080

Then i created a dep directory in the location where i strore my program
in the eclipse workspace

C:\EclipseWorkspace\test_sam7x_c++\dep

and changed the line in makefile

GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d

for

GENDEPFLAGS = -MD -MP -MF dep/$(@F).d

For the warning : There was missing declaration for that function in
dgu.c

So i declared that function sisscanf , actually it was commented before
so i removed the comment.

Now everything works fine.

One more i like to suggest is building from command prompt is always a
good idea when we have errors as we can see more errors as suggested by
my friend Jonathan as well.

I got one more error when was coipling using simple c++ programs after
buiding the project like

ld: internal error ../../binutils-2.17/ld/ldlang.c 4275  test_c++ line 0
1175273524248 1077

But when i declared a constructor for a class then it got rectified.

I dont know many things about these files i am very new to arm
microcontroller programming but hope this message helps someone like me.

Regards
Rajitha

Author: Jonathan Dumaresq (dumarjo)
Posted on:

Rate this post
0 useful
not useful
> Hi
>
> The errors have been corrected now.
>
> Thank you Jonathan for your support to solve this problem . It was
> really a great help to me.
>
>
> I dont know many things about these files i am very new to arm
> microcontroller programming but hope this message helps someone like me.
>
> Regards
> Rajitha

Good luck with your project now !

Jonathan

Author: Aaron D'souza (adsouzp)
Posted on:

Rate this post
0 useful
not useful
hello:

error from ldlang.c line 4275 is a known issue and has been fixed in
the latest binutils. GNUARM 4.1.1 has this error. Pablo Bleyer Kocik
has been informed. pls see Sourceware BugZilla bug reports for 6726
and 6727 for updates on the issue.

a detailed summary is provided below.

Flying Arm wrote:
> I think there is some problem with the Linker script memory regions and
> ld.exe .
>
> Please see this error:
>
> Errors:
>
> ld: internal error ../../binutils-2.17/ld/ldlang.c 4275    test_c++
> line 0  1175180093750  880

i have found 2 problems with the current GNUARM distribution, which Nick
Clifton has said are due to errors in binutils that have already been
fixed in
the latest version.

2 bugs have been filed with GCC and reports have been filed with
Comp.Arch.Embedded and Mikrocontroller.net Forum.

the problem was reproduced using simple, sample code and details have
been
added into the Sourceware BugZilla bug reports.

the information below is for your reference. kindly let me know if you
need any
more information.

pls see these links for more information:
- GCC Bugzilla Bug 6726
  http://sourceware.org/bugzilla/show_bug.cgi?id=6726

- GCC Bugzilla Bug 6727
  http://sourceware.org/bugzilla/show_bug.cgi?id=6727

- Mikrocontroller.net Forum
  http://en.mikrocontroller.net/topic/158791#699646

- Comp.Arch.Embedded
  http://www.embeddedrelated.com/usenet/embedded/sho...

GLOBAL CONDITIONS
if:
- you enable --gc-sections
- you enable Thumb Interworking

PROBLEM 1
- if you do not define program entry point: you get the ldlang.c 4275
error

SOLUTION 1
- simply define entry point _start or whatever using --entry if required

PROBLEM
- you position another section using --section-start before .text using
-Ttext:
  you get ZERO interworking code

SOLUTION
- position .data/other section AFTER .text. place -Ttext before
--section-start
  or -Tdata.

i hope that this is helpful to you.

Aaron
--
{tel: +91-20-6526-7076; cell: +91-9970-591-079; fax: +1-800-450-5419}

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.