Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

C code inline with assembler file output

C code inline with assembler file output

2005-10-19 by roelof t Hooft

Hi all,

I would like to have the C code combined with the
generated assembler output.
I have these lines in the source code :

//      bcfg0 = 0x2000fbef;

        bcfg0 = ((flash_mw << 28) | (flash_bm << 27) | (flash_wp <<
26) | (flash_wst2 << 11) | (flash_rble << 10) | (flash_wst1 << 5) |
flash_idcy);

The values for the second line are defined in a header file. Now I
want to see the generated hex value. It is there in the corresponding
.lst file, but there's no reference to the source code line that
belongs to it.

How can I make the compiler/assembler/linker include the lines of
source code (in the assembler output) for reference ?

I'm a bit puzzled by the wealth of options offered by the different
programs. I also included the most common, I think, options to no
avail.

TIA

roelof

Re: C code inline with assembler file output

2005-10-19 by roelof t Hooft

--- In lpc2000@yahoogroups.com, "roelof t Hooft" <roelofh@i...> wrote:

Forgot to mention that I'm using arm-elf-* compiled with
the scripts from rod.info under Debian linux.

roelof

Re: C code inline with assembler file output

2005-10-19 by bdmlpc

Hello,

just turn on debugging info ('-g') and have a look at your object- or
elf-file with 'arm-elf-objdump -DS <file>'. This will display C-source
and assembler in a mix. Hint: If you turn off optimization ('-O') the
output is more readable!

  Sten

--- In lpc2000@yahoogroups.com, "roelof t Hooft" <roelofh@i...> wrote:
Show quoted textHide quoted text
>
> Hi all,
> 
> I would like to have the C code combined with the
> generated assembler output.
> I have these lines in the source code :
> 
> //      bcfg0 = 0x2000fbef;
> 
>         bcfg0 = ((flash_mw << 28) | (flash_bm << 27) | (flash_wp <<
> 26) | (flash_wst2 << 11) | (flash_rble << 10) | (flash_wst1 << 5) |
> flash_idcy);
> 
> The values for the second line are defined in a header file. Now I
> want to see the generated hex value. It is there in the corresponding
> .lst file, but there's no reference to the source code line that
> belongs to it.
> 
> How can I make the compiler/assembler/linker include the lines of
> source code (in the assembler output) for reference ?
> 
> I'm a bit puzzled by the wealth of options offered by the different
> programs. I also included the most common, I think, options to no
> avail.
> 
> TIA
> 
> roelof
>

Re: C code inline with assembler file output

2005-10-19 by rtstofer

--- In lpc2000@yahoogroups.com, "bdmlpc" <list@n...> wrote:
>
> Hello,
> 
> just turn on debugging info ('-g') and have a look at your object- or
> elf-file with 'arm-elf-objdump -DS <file>'. This will display C-
source
> and assembler in a mix. Hint: If you turn off optimization ('-O') the
> output is more readable!
> 
>   Sten

^^^ EXCELLENT! ^^^

I decided to get a combined .LST file for every source by using:

CFLAGS  = -I./ -c -fno-common -O0 -g -Wa,-ahls=$*.lst -Wall
.....................................^^^^^^^^^^^^^^^^

Richard

Re: C code inline with assembler file output

2005-10-19 by roelof t Hooft

--- In lpc2000@yahoogroups.com, "bdmlpc" <list@n...> wrote:
>
> Hello,
> 
> just turn on debugging info ('-g') and have a look at your object- or
> elf-file with 'arm-elf-objdump -DS <file>'. This will display C-source
> and assembler in a mix. Hint: If you turn off optimization ('-O') the
> output is more readable!

Thank you for responding.

The arm-elf-objdump command generated a whopping 8 MB file
but not with the nessecary debugging information :-(
Unfortunally there seems to be no debugger output in the
.lst file either while in other's there is. No matter
the settings I tried. So I copied the line of source to
be debugged into the file that generated the debug
info in the .lst output and took it from there.

roelof

Re: [lpc2000] Re: C code inline with assembler file output

2005-10-19 by Sten

roelof t Hooft wrote:
> --- In lpc2000@yahoogroups.com, "bdmlpc" <list@n...> wrote:
> 
>>Hello,
>>
>>just turn on debugging info ('-g') and have a look at your object- or
>>elf-file with 'arm-elf-objdump -DS <file>'. This will display C-source
>>and assembler in a mix. Hint: If you turn off optimization ('-O') the
>>output is more readable!
> 
> 
> Thank you for responding.
> 
> The arm-elf-objdump command generated a whopping 8 MB file
> but not with the nessecary debugging information :-(
> Unfortunally there seems to be no debugger output in the
> .lst file either while in other's there is. No matter
> the settings I tried. So I copied the line of source to
> be debugged into the file that generated the debug
> info in the .lst output and took it from there.
> 
> roelof
> 

?!?
Did you try to dump the object file only? There should be mix of C
source and assembly output.

arm-elf-gcc -c -o test.c
arm-elf-objdump -DS test.o

   Sten

-- 
/************************************************
 Do you need a tiny and efficient real time
 operating system (RTOS) with a preemtive
 multitasking for LPC2000 or AT91SAM7?

   http://nanortos.net-attack.de/

 Or some open-source tools and code for LPC2000?

   http://www.net-attack.de/

************************************************/

Re: C code inline with assembler file output

2005-10-26 by roelof t Hooft

--- In lpc2000@yahoogroups.com, Sten <list@n...> wrote:
> ?!?
> Did you try to dump the object file only? There should be mix of C
> source and assembly output.

There is a mix of c code and assembler in an/the output
file, but not the (4) lines of c code I needed.
That is why I put the code in a different source file
which would appear in the output (c/ass. mix) file.

Thanks

roelof

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.