Author Topic: Problem Hex file not generate For ARM microcontroller using C::B  (Read 19794 times)

Offline shikamaru

  • Single posting newcomer
  • *
  • Posts: 4
Problem Hex file not generate For ARM microcontroller using C::B
« on: December 30, 2008, 05:34:05 pm »
Dear Forum,

I'm newbie.

Please help me to setup C::B for programming ARM. i've read many tutorials for setting c::b for arm but still Ive found error.

My System use :
 C::B Version 8.02
 GNU ARM Version bu-2.16.1_gcc-4.0.1-c-c++_nl-1.13.0_gi-6.1.exe ( I assumed I use version 4.0.1)
 My Os is Windows XP Service Pack 3.
 ARM LPC2148 (and for trial i compile program for LP2106)

From the wiki tutorial I got ,  setup c::B was very simple :
1. Make Empty Project
2. Chose Compiler GNU ARM GCC
3. And Follow the step ( what's the different between debug and release? ==> I just check them both)
4. And C::B said the wizard doesn't know how to setup warning flags (from the tutorial just ignore that)

and then i add 5 files ( source code from the wiki led_blink_flash) :
1. crt.s
2.demo2106_blink_flash_cmd (does this file use for compiler?)
3.lpc210x.h
4.main.c
5.makefile ( does C::B need makefile for ARM ? I try the Project AVR and it was great doesn't need makefile ).

I check all file  for debug and release.

and the I go to setting ==> compiler and debugger
 - in Tab Toolchain Executebles in click autodetect. (directory installation is same as found ==> do i have to setup additional paths?)
 - in Tab Search Directories :
   I added path:
   1. Compiler => C:\Program Files\GNUARM\include
   2. Linker    => C:\Program Files\GNUARM\lib
   3. Resource Compiler => None ( Do I have to add additional path to this? if yes, what folder?)
-  in the compiler setting what flags must I choose? do i have setup the otheroptions and #defines?


and the i go to menu project => properties
- in tab Project setting :
   platform => all
   makefile => check custom makefile (in startegy  I choose generate PCH alongside original header. what this for?)
- in build targets :
  Debug    => Platforms All, type Native.
  Release  => Platforms All, type Native.

and the the result after compile :
1. with project setting => makefilel check
   //////////////////////////////////////////////////////////////
    make: Makefile: No such file or directory
    make: *** No rule to make target `Makefile'.  Stop.
    Process terminated with status 2 (0 minutes, 0 seconds)
     0 errors, 0 warnings
   ////////////////////////////////////////////////////////////
2. with project setting => makefilel uncheck
   ///////////////////////////////////////////////////////////////
   [100.0%] arm-elf-g++.exe -L"C:\Program Files\GNUARM\lib"  -o bin\Debug\testa.exe obj\Debug\sampleprogra\demo2106_blink_flash  \main.o obj\Debug\sampleprogra\demo2106_blink_flash\crt.o   
obj\Debug\sampleprogra\demo2106_blink_flash\crt.o: In function `Reset_Handler':
: undefined reference to `_stack_end'
obj\Debug\sampleprogra\demo2106_blink_flash\crt.o: In function `Reset_Handler':
: undefined reference to `_data'
obj\Debug\sampleprogra\demo2106_blink_flash\crt.o: In function `Reset_Handler':
: undefined reference to `_bss_start'
obj\Debug\sampleprogra\demo2106_blink_flash\crt.o: In function `Reset_Handler':
: undefined reference to `_bss_end'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
   ///////////////////////////////////////////////////////////
for the second result no Hex file generated . (why ? 0 errors and 0 warnings?)

 Need your advice and solutions ?

 Thanks a lot guys .

 


mariocup

  • Guest
Re: Problem Hex file not generate For ARM microcontroller using C::B
« Reply #1 on: December 30, 2008, 10:34:32 pm »
Quote
3. And Follow the step ( what's the different between debug and release? ==> I just check them both)

The debug build target will generate an executable with debug (compiler option -g) information. In the release target the debug information is stripped from the executable.

Quote
- in Tab Toolchain Executebles in click autodetect. (directory installation is same as found ==> do i have to setup additional paths?)
The autodetect only works, if the toolchain is registered in the registry. Which ARM Toolchain are you using?

Quote
-  in the compiler setting what flags must I choose? do i have setup the otheroptions and #defines?
You should read the GCC manual to see what arm option is required for your derivative.

Quote
and the i go to menu project => properties
- in tab Project setting :
   platform => all
   makefile => check custom makefile (in startegy  I choose generate PCH alongside original header. what this for?)
- in build targets :
  Debug    => Platforms All, type Native.
  Release  => Platforms All, type Native.

There is no need for a custom makefile. You can use the normal CB projects to build your ARM projects.
The hex file are not generated automatically. If you want to generate a hex file, then you should use e.g. a post build step like:
Code
arm-elf-objcopy -O ihex executable hexfile

Some time ago I added also some ARM wizards for CB and they should work. Did you try them?

Bye,

Mario

Offline shikamaru

  • Single posting newcomer
  • *
  • Posts: 4
Re: Problem Hex file not generate For ARM microcontroller using C::B
« Reply #2 on: December 31, 2008, 01:24:51 am »
Thanks for your reply,

Quote
- in Tab Toolchain Executebles in click autodetect. (directory installation is same as found ==> do i have to setup additional paths?)
The autodetect only works, if the toolchain is registered in the registry. Which ARM Toolchain are you using


I use GNU ARM version 4.0.1.


There is no need for a custom makefile. You can use the normal CB projects to build your ARM projects.
The hex file are not generated automatically. If you want to generate a hex file, then you should use e.g. a post build step like:
Code:
arm-elf-objcopy -O ihex executable hexfile

Some time ago I added also some ARM wizards for CB and they should work. Did you try them?


arm-elf-objcopy -O ihex executable hexfile for this code where i should put it ? in porject options or build options ? which tabs?.

I search for your wizards, but i still haven't found them. Please give me the link.


thanks a lot,

shikmaru (fighting dreamer)  :lol:

mariocup

  • Guest
Re: Problem Hex file not generate For ARM microcontroller using C::B
« Reply #3 on: December 31, 2008, 11:39:02 am »
Hi shikamaru,

first of all which svn version of CB do you have?

The hex file conversion can be set as post build steps in:#
1. Select Project->Build Options
2. Choose Tab Pre/Postbuild Steps
3. Enter the commands for hex file conversion in the post build steps

You can start the wizards via:
New->Project

then select the ARM Project.

Bye,

Mario

Offline shikamaru

  • Single posting newcomer
  • *
  • Posts: 4
Re: Problem Hex file not generate For ARM microcontroller using C::B
« Reply #4 on: December 31, 2008, 01:16:48 pm »

Thanks mario,


Quote
first of all which svn version of CB do you have?

I use c::b version 8.02 MingW.

Quote
The hex file conversion can be set as post build steps in:#
1. Select Project->Build Options
2. Choose Tab Pre/Postbuild Steps
3. Enter the commands for hex file conversion in the post build steps

I already set the build options as you told. But still hex file not generated. i just found .sys

the output is like this :

Quote
Target is up to date.
[100.0%] Running target post-build steps
arm-elf-objcopy -O ihex
Usage: arm-elf-objcopy [option(s)] in-file [out-file]
 Copies a binary file, possibly transforming it in the process
 The options are:
  -I --input-target <bfdname>      Assume input file is in format <bfdname>
  -O --output-target <bfdname>     Create an output file in format <bfdname>
  -B --binary-architecture <arch>  Set arch of output file, when input is binary
  -F --target <bfdname>            Set both input and output format to <bfdname>
     --debugging                   Convert debugging information, if possible
  -p --preserve-dates              Copy modified/access timestamps to the output
  -j --only-section <name>         Only copy section <name> into the output
     --add-gnu-debuglink=<file>    Add section .gnu_debuglink linking to <file>
  -R --remove-section <name>       Remove section <name> from the output
  -S --strip-all                   Remove all symbol and relocation information
  -g --strip-debug                 Remove all debugging symbols & sections
     --strip-unneeded              Remove all symbols not needed by relocations
  -N --strip-symbol <name>         Do not copy symbol <name>
     --strip-unneeded-symbol <name>
                                   Do not copy symbol <name> unless needed by
                                     relocations
     --only-keep-debug             Strip everything but the debug information
  -K --keep-symbol <name>          Only copy symbol <name>
  -L --localize-symbol <name>      Force symbol <name> to be marked as a local
  -G --keep-global-symbol <name>   Localize all symbols except <name>
  -W --weaken-symbol <name>        Force symbol <name> to be marked as a weak
     --weaken                      Force all global symbols to be marked as weak
  -w --wildcard                    Permit wildcard in symbol comparison
  -x --discard-all                 Remove all non-global symbols
  -X --discard-locals              Remove any compiler-generated symbols
  -i --interleave <number>         Only copy one out of every <number> bytes
  -b --byte <num>                  Select byte <num> in every interleaved block
     --gap-fill <val>              Fill gaps between sections with <val>
     --pad-to <addr>               Pad the last section up to address <addr>
     --set-start <addr>            Set the start address to <addr>
    {--change-start|--adjust-start} <incr>
                                   Add <incr> to the start address
    {--change-addresses|--adjust-vma} <incr>
                                   Add <incr> to LMA, VMA and start addresses
    {--change-section-address|--adjust-section-vma} <name>{=|+|-}<val>
                                   Change LMA and VMA of section <name> by <val>
     --change-section-lma <name>{=|+|-}<val>
                                   Change the LMA of section <name> by <val>
     --change-section-vma <name>{=|+|-}<val>
                                   Change the VMA of section <name> by <val>
    {--[no-]change-warnings|--[no-]adjust-warnings}
                                   Warn if a named section does not exist
     --set-section-flags <name>=<flags>
                                   Set section <name>'s properties to <flags>
     --add-section <name>=<file>   Add section <name> found in <file> to output
     --rename-section <old>=<new>[,<flags>] Rename section <old> to <new>
     --change-leading-char         Force output format's leading character style
     --remove-leading-char         Remove leading character from global symbols
     --redefine-sym <old>=<new>    Redefine symbol name <old> to <new>
     --redefine-syms <file>        --redefine-sym for all symbol pairs
                                     listed in <file>
     --srec-len <number>           Restrict the length of generated Srecords
     --srec-forceS3                Restrict the type of generated Srecords to S3
     --strip-symbols <file>        -N for all symbols listed in <file>
     --strip-unneeded-symbols <file>
                                   --strip-unneeded-symbol for all symbols listed
                                     in <file>
     --keep-symbols <file>         -K for all symbols listed in <file>
     --localize-symbols <file>     -L for all symbols listed in <file>
     --keep-global-symbols <file>  -G for all symbols listed in <file>
     --weaken-symbols <file>       -W for all symbols listed in <file>
     --alt-machine-code <index>    Use alternate machine code for output
     --writable-text               Mark the output text as writable
     --readonly-text               Make the output text write protected
     --pure                        Mark the output file as demand paged
     --impure                      Mark the output file as impure
     --prefix-symbols <prefix>     Add <prefix> to start of every symbol name
     --prefix-sections <prefix>    Add <prefix> to start of every section name
     --prefix-alloc-sections <prefix>
                                   Add <prefix> to start of every allocatable
                                     section name
  -v --verbose                     List all object files modified
  -V --version                     Display this program's version number
  -h --help                        Display this output
     --info                        List object formats & architectures supported
arm-elf-objcopy: supported targets: elf32-littlearm elf32-bigarm elf32-little elf32-big srec symbolsrec tekhex binary ihex
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
 

but still I didn't find any .hex file or .obj file. What should I do?

one more questions :

Quote
You can start the wizards via:
New->Project
then select the ARM Project.

My version c:: doesn't have Arm Project in the wizard ( c::b version 8.02 MingW). What version of c::b has arm template? where is your arm wizard ? can you give me the link for download?

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Problem Hex file not generate For ARM microcontroller using C::B
« Reply #5 on: December 31, 2008, 01:55:32 pm »
Usage: arm-elf-objcopy [option(s)] in-file [out-file]

You miss in- and outfile.
Try something like:

Code
arm-elf-objcopy -O ihex ${TARGET_OUTPUT_FILE} ${TARGET_OUTPUT_DIR}${TARGET_OUTPUT_BASENAME}.hex

There's no space between ${TARGET_OUTPUT_DIR} and ${TARGET_OUTPUT_BASENAME}.

mariocup

  • Guest
Re: Problem Hex file not generate For ARM microcontroller using C::B
« Reply #6 on: December 31, 2008, 04:13:42 pm »
Hi shikamaru,

update to one the current nightly builds and then you will find the wizards.

Offline shikamaru

  • Single posting newcomer
  • *
  • Posts: 4
Re: Problem Hex file not generate For ARM microcontroller using C::B
« Reply #7 on: January 03, 2009, 01:33:31 am »
Thanks for all of u guys,

Finally it's works. Now I have 2 options for programming ARM, 1. PN with WINARM and 2. CodeBlocks with GNUARM.

Thanks A lot for this forum.

Nuhun Maneh Teh Nu Garelo Sing Balegnya 2009 ( This Indonesian sundanese Languange) => "Hope The Best for All of U In The New Year 2009"

Offline trilog

  • Single posting newcomer
  • *
  • Posts: 2
Re: Problem Hex file not generate For ARM microcontroller using C::B
« Reply #8 on: April 12, 2010, 08:35:29 am »
Hi shikamaru,

I am new to c::b

me too facing the same problem you have faced........



///////////////////////////////////////////////////////////////
   [100.0%] arm-elf-g++.exe -L"C:\Program Files\GNUARM\lib"  -o bin\Debug\testa.exe obj\Debug\sampleprogra\demo2106_blink_flash  \main.o obj\Debug\sampleprogra\demo2106_blink_flash\crt.o  
obj\Debug\sampleprogra\demo2106_blink_flash\crt.o: In function `Reset_Handler':
: undefined reference to `_stack_end'
obj\Debug\sampleprogra\demo2106_blink_flash\crt.o: In function `Reset_Handler':
: undefined reference to `_data'
obj\Debug\sampleprogra\demo2106_blink_flash\crt.o: In function `Reset_Handler':
: undefined reference to `_bss_start'
obj\Debug\sampleprogra\demo2106_blink_flash\crt.o: In function `Reset_Handler':
: undefined reference to `_bss_end'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
   ///////////////////////////////////////////////////////////



how you fixed this errors....????

Thanks in advance
Trilog

« Last Edit: April 13, 2010, 09:44:56 am by trilog »