cmd /C "arm-elf-objdump ... "
Output file is ..\result\Core0.elf with size 406.01 KB
[100.0%] Running target post-build steps
tricore-objcopy -O ihex ..\result\Core0.elf ..\result\Core0.hex
Process terminated with status 0 (0 minute(s), 9 second(s))
0 error(s), 0 warning(s) (0 minute(s), 9 second(s))
Build log saved as:
There is no messages concerned with "post-build", but certainly it's due to the fact that build failed.exactly. Post build steps are only executed if the build succeeds. You can create a tool with the tools+ plugin for now, so you can execute the objdump command from the menu with the current file...
For the moment I can't build entire projects.It's not an issue with the ARM GCC integration into Code::Blocks. I assume that you are new to Embedded programming...
Build generates errors for reasons that I don't understand for the moment.
Without doubt the GNU Tools ARM Embedded tool-chain isn't properly integrated into Code::Blocks ... but it's the subject of my other post published earlier.
Here I've just tried to build with toolchain executables from Code::Blocks bin.this is bul**** you can't compile arm code with a x86 compiler (you can but you will get errors)
Whereas linker script is called fromNo, it calls the linker script:
C:\Program Files (x86)\CodeBlocks\share\CodeBlocks\templates\wizard\arm\files\ARM-eval7t\ld\target.ld, where the similar symbols are __bss_start and __bss_end
Its location is defined here (highlighted in yellow):
-T ld/target
QuoteHere I've just tried to build with toolchain executables from Code::Blocks bin.this is bul**** you can't compile arm code with a x86 compiler (you can but you will get errors)
Also x86 don't need linker scripts...
The linker scripts provided in "C:\Program Files (x86)\CodeBlocks\share\CodeBlocks\templates\wizard\arm\files\{ARM_platform_name}\ld\" are compatible with at least one of the "hundreds of different compilers for arm cores" (or none at all and should be edited to use with a particular compiler).The linker script is mainly processor dependent, not compile/linker dependent (in the form that 90% of the arm compiler/linker out there are based on the gnu environment). Learn what the linker script do and you will answer this question by your own... The main purpose of the linker script is to tell the linker where the ram/ flash, interrupt handler are located in the processor, and this has nothing to do with the compiler but all with the processor....
One question remains: if there are multiple .o files in TARGET\src, how to modify the post-build command in order to take into account all .o files ?
One question remains: if there are multiple .o files in TARGET\src, how to modify the post-build command in order to take into account all .o files ?
You can use squirrel scripting for this: http://wiki.codeblocks.org/index.php/Scripting_Code::Blocks
http://wiki.codeblocks.org/index.php/Variable_expansion#Script_expansion
greetings
One question remains: if there are multiple .o files in TARGET\src, how to modify the post-build command in order to take into account all .o files ?
You can use squirrel scripting for this: http://wiki.codeblocks.org/index.php/Scripting_Code::Blocks
http://wiki.codeblocks.org/index.php/Variable_expansion#Script_expansion
greetings
I didn't find a way how to integrate such script as a file and tried it "inline".you can try the dofile command: http://squirrel-lang.org/squirreldoc/stdlib/stdiolib.html#global-symbols But i am not sure if this is embedded in codeblocks
t works fine, but for my task I need to access to target directory (i.e. default) to process .o files.Can't you use hard coded paths? If you use standard templates from codeblocks the o files are always at the same sub direcotry... Or what exact information do you need?
Can't you use hard coded paths? If you use standard templates from codeblocks the o files are always at the same sub direcotry... Or what exact information do you need?
That wouldn't be my preferred solution.
If you want assembly files for all compiled modules, just use the GCC compiler switch -save-temps and get rid of the post-build step.
short checksum_v1(int *data);
int main (void) {
int data[64];
int checksum = checksum_v1(data);
return 0;
}
short checksum_v1(int *data)
{
unsigned int i;
int sum = 0;
for (i = 0; i < 64; i++)
{
sum += *(data++);
}
return (short)sum;
}
#ifndef __NO_SYSTEM_INIT
void SystemInit()
{}
#endif
void _exit(int status)
{
}
default\src\main.o: file format elf32-littlearm
Disassembly of section .text:
00000000 <checksum_v1>:
0: e3a03000 mov r3, #0
4: e2801c01 add r1, r0, #256 ; 0x100
8: e4902004 ldr r2, [r0], #4
c: e1510000 cmp r1, r0
10: e0833002 add r3, r3, r2
14: 1afffffb bne 8 <checksum_v1+0x8>
18: e1a00803 lsl r0, r3, #16
1c: e1a00840 asr r0, r0, #16
20: e12fff1e bx lr
00000024 <SystemInit>:
24: e12fff1e bx lr
00000028 <_exit>:
28: e12fff1e bx lr
Disassembly of section .text.startup:
00000000 <main>:
0: e3a00000 mov r0, #0
4: e12fff1e bx lr
.cpu arm7tdmi
.fpu softvfp
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 26, 1
.eabi_attribute 30, 2
.eabi_attribute 34, 0
.eabi_attribute 18, 4
.arm
.syntax divided
.file "main.c"
.text
.Ltext0:
.cfi_sections .debug_frame
.section .text.startup,"ax",%progbits
.align 2
.global main
.type main, %function
main:
.LFB0:
.file 1 "src\\main.c"
.loc 1 2 0
.cfi_startproc
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
.LVL0:
.loc 1 6 0
mov r0, #0
bx lr
.cfi_endproc
.LFE0:
.size main, .-main
.text
.align 2
.global checksum_v1
.type checksum_v1, %function
checksum_v1:
.LFB1:
.loc 1 9 0
.cfi_startproc
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
.LVL1:
.loc 1 11 0
mov r3, #0
add r1, r0, #256
.LVL2:
.L3:
.loc 1 14 0 discriminator 3
ldr r2, [r0], #4
.LVL3:
.loc 1 12 0 discriminator 3
cmp r1, r0
.loc 1 14 0 discriminator 3
add r3, r3, r2
.LVL4:
.loc 1 12 0 discriminator 3
bne .L3
.loc 1 16 0
mov r0, r3, asl #16
.LVL5:
.loc 1 17 0
mov r0, r0, asr #16
bx lr
.cfi_endproc
.LFE1:
.size checksum_v1, .-checksum_v1
.align 2
.global SystemInit
.type SystemInit, %function
SystemInit:
.LFB2:
.loc 1 22 0
.cfi_startproc
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
bx lr
.cfi_endproc
.LFE2:
.size SystemInit, .-SystemInit
.align 2
.global _exit
.type _exit, %function
_exit:
.LFB3:
.loc 1 26 0
.cfi_startproc
@ Function supports interworking.
@ Volatile: function does not return.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
.LVL6:
.loc 1 27 0
bx lr
.cfi_endproc
.LFE3:
.size _exit, .-_exit
.Letext0:
.section .debug_info,"",%progbits
.Ldebug_info0:
.4byte 0x114
.2byte 0x4
.4byte .Ldebug_abbrev0
.byte 0x4
.uleb128 0x1
.4byte .LASF4
.byte 0xc
.4byte .LASF5
.4byte .LASF6
.4byte .Ldebug_ranges0+0
.4byte 0
.4byte .Ldebug_line0
.uleb128 0x2
.4byte .LASF7
.byte 0x1
.byte 0x8
.4byte 0x55
.byte 0x1
.4byte 0x55
.uleb128 0x3
.4byte .LASF2
.byte 0x1
.byte 0x8
.4byte 0x5c
.uleb128 0x4
.ascii "i\000"
.byte 0x1
.byte 0xa
.4byte 0x69
.uleb128 0x4
.ascii "sum\000"
.byte 0x1
.byte 0xb
.4byte 0x62
.byte 0
.uleb128 0x5
.byte 0x2
.byte 0x5
.4byte .LASF0
.uleb128 0x6
.byte 0x4
.4byte 0x62
.uleb128 0x7
.byte 0x4
.byte 0x5
.ascii "int\000"
.uleb128 0x5
.byte 0x4
.byte 0x7
.4byte .LASF1
.uleb128 0x8
.4byte .LASF8
.byte 0x1
.byte 0x2
.4byte 0x62
.4byte .LFB0
.4byte .LFE0-.LFB0
.uleb128 0x1
.byte 0x9c
.4byte 0xa1
.uleb128 0x9
.4byte .LASF2
.byte 0x1
.byte 0x3
.4byte 0xa1
.uleb128 0xa
.4byte .LASF9
.byte 0x1
.byte 0x4
.4byte 0x62
.byte 0
.byte 0
.uleb128 0xb
.4byte 0x62
.4byte 0xb1
.uleb128 0xc
.4byte 0xb1
.byte 0x3f
.byte 0
.uleb128 0x5
.byte 0x4
.byte 0x7
.4byte .LASF3
.uleb128 0xd
.4byte 0x25
.4byte .LFB1
.4byte .LFE1-.LFB1
.uleb128 0x1
.byte 0x9c
.4byte 0xe7
.uleb128 0xe
.4byte 0x35
.4byte .LLST0
.uleb128 0xf
.4byte 0x40
.4byte .LLST1
.uleb128 0xf
.4byte 0x49
.4byte .LLST2
.byte 0
.uleb128 0x10
.4byte .LASF10
.byte 0x1
.byte 0x15
.4byte .LFB2
.4byte .LFE2-.LFB2
.uleb128 0x1
.byte 0x9c
.uleb128 0x11
.4byte .LASF11
.byte 0x1
.byte 0x19
.4byte .LFB3
.4byte .LFE3-.LFB3
.uleb128 0x1
.byte 0x9c
.uleb128 0x12
.4byte .LASF12
.byte 0x1
.byte 0x19
.4byte 0x62
.uleb128 0x1
.byte 0x50
.byte 0
.byte 0
.section .debug_abbrev,"",%progbits
.Ldebug_abbrev0:
.uleb128 0x1
.uleb128 0x11
.byte 0x1
.uleb128 0x25
.uleb128 0xe
.uleb128 0x13
.uleb128 0xb
.uleb128 0x3
.uleb128 0xe
.uleb128 0x1b
.uleb128 0xe
.uleb128 0x55
.uleb128 0x17
.uleb128 0x11
.uleb128 0x1
.uleb128 0x10
.uleb128 0x17
.byte 0
.byte 0
.uleb128 0x2
.uleb128 0x2e
.byte 0x1
.uleb128 0x3f
.uleb128 0x19
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x27
.uleb128 0x19
.uleb128 0x49
.uleb128 0x13
.uleb128 0x20
.uleb128 0xb
.uleb128 0x1
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0x3
.uleb128 0x5
.byte 0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0x4
.uleb128 0x34
.byte 0
.uleb128 0x3
.uleb128 0x8
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0x5
.uleb128 0x24
.byte 0
.uleb128 0xb
.uleb128 0xb
.uleb128 0x3e
.uleb128 0xb
.uleb128 0x3
.uleb128 0xe
.byte 0
.byte 0
.uleb128 0x6
.uleb128 0xf
.byte 0
.uleb128 0xb
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0x7
.uleb128 0x24
.byte 0
.uleb128 0xb
.uleb128 0xb
.uleb128 0x3e
.uleb128 0xb
.uleb128 0x3
.uleb128 0x8
.byte 0
.byte 0
.uleb128 0x8
.uleb128 0x2e
.byte 0x1
.uleb128 0x3f
.uleb128 0x19
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x27
.uleb128 0x19
.uleb128 0x49
.uleb128 0x13
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x6
.uleb128 0x40
.uleb128 0x18
.uleb128 0x2117
.uleb128 0x19
.uleb128 0x1
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0x9
.uleb128 0x34
.byte 0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0xa
.uleb128 0x34
.byte 0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.uleb128 0x1c
.uleb128 0xb
.byte 0
.byte 0
.uleb128 0xb
.uleb128 0x1
.byte 0x1
.uleb128 0x49
.uleb128 0x13
.uleb128 0x1
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0xc
.uleb128 0x21
.byte 0
.uleb128 0x49
.uleb128 0x13
.uleb128 0x2f
.uleb128 0xb
.byte 0
.byte 0
.uleb128 0xd
.uleb128 0x2e
.byte 0x1
.uleb128 0x31
.uleb128 0x13
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x6
.uleb128 0x40
.uleb128 0x18
.uleb128 0x2117
.uleb128 0x19
.uleb128 0x1
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0xe
.uleb128 0x5
.byte 0
.uleb128 0x31
.uleb128 0x13
.uleb128 0x2
.uleb128 0x17
.byte 0
.byte 0
.uleb128 0xf
.uleb128 0x34
.byte 0
.uleb128 0x31
.uleb128 0x13
.uleb128 0x2
.uleb128 0x17
.byte 0
.byte 0
.uleb128 0x10
.uleb128 0x2e
.byte 0
.uleb128 0x3f
.uleb128 0x19
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x6
.uleb128 0x40
.uleb128 0x18
.uleb128 0x2117
.uleb128 0x19
.byte 0
.byte 0
.uleb128 0x11
.uleb128 0x2e
.byte 0x1
.uleb128 0x3f
.uleb128 0x19
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x27
.uleb128 0x19
.uleb128 0x87
.uleb128 0x19
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x6
.uleb128 0x40
.uleb128 0x18
.uleb128 0x2117
.uleb128 0x19
.byte 0
.byte 0
.uleb128 0x12
.uleb128 0x5
.byte 0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.uleb128 0x2
.uleb128 0x18
.byte 0
.byte 0
.byte 0
.section .debug_loc,"",%progbits
.Ldebug_loc0:
.LLST0:
.4byte .LVL1
.4byte .LVL3
.2byte 0x1
.byte 0x50
.4byte .LVL3
.4byte .LVL4
.2byte 0x3
.byte 0x70
.sleb128 -4
.byte 0x9f
.4byte .LVL4
.4byte .LVL5
.2byte 0x1
.byte 0x50
.4byte 0
.4byte 0
.LLST1:
.4byte .LVL1
.4byte .LVL2
.2byte 0x2
.byte 0x30
.byte 0x9f
.4byte 0
.4byte 0
.LLST2:
.4byte .LVL1
.4byte .LVL2
.2byte 0x2
.byte 0x30
.byte 0x9f
.4byte .LVL2
.4byte .LFE1
.2byte 0x1
.byte 0x53
.4byte 0
.4byte 0
.section .debug_aranges,"",%progbits
.4byte 0x24
.2byte 0x2
.4byte .Ldebug_info0
.byte 0x4
.byte 0
.2byte 0
.2byte 0
.4byte .Ltext0
.4byte .Letext0-.Ltext0
.4byte .LFB0
.4byte .LFE0-.LFB0
.4byte 0
.4byte 0
.section .debug_ranges,"",%progbits
.Ldebug_ranges0:
.4byte .Ltext0
.4byte .Letext0
.4byte .LFB0
.4byte .LFE0
.4byte 0
.4byte 0
.section .debug_line,"",%progbits
.Ldebug_line0:
.section .debug_str,"MS",%progbits,1
.LASF11:
.ascii "_exit\000"
.LASF1:
.ascii "unsigned int\000"
.LASF7:
.ascii "checksum_v1\000"
.LASF12:
.ascii "status\000"
.LASF10:
.ascii "SystemInit\000"
.LASF0:
.ascii "short int\000"
.LASF9:
.ascii "checksum\000"
.LASF3:
.ascii "sizetype\000"
.LASF8:
.ascii "main\000"
.LASF5:
.ascii "src\\main.c\000"
.LASF2:
.ascii "data\000"
.LASF6:
.ascii "C:\\\\Users\\\\Pavel\\\\Documents\\\\proj_ARM\\\\pr"
.ascii "oj1\000"
.LASF4:
.ascii "GNU C11 5.4.1 20160919 (release) [ARM/embedded-5-br"
.ascii "anch revision 240496] -mcpu=arm7tdmi -g -g -O2 -fno"
.ascii "-common\000"
.ident "GCC: (GNU Tools for ARM Embedded Processors) 5.4.1 20160919 (release) [ARM/embedded-5-branch revision 240496]"
main.s is the interim assembly file that has been generated by the compiler. It contains a lot of information needed by the assembler (e.g. that there is a global symbol named "main", which is a function that has a 2 Byte alignment requirement).For the moment I don't need to disassembly application, but rather file by file ... to estimate the efficiency of compiled code.
main.asm is just a disassembly file that has been derived from the object file (generated by the assembler).
If you want a full disassembly of your application, maybe you can disassemble the elf file with objdump instead of each object file on it's own?
cmd /C arm-none-eabi-objdump -d $(TARGET_OUTPUT_DIR)src\main.o > $(TARGET_OUTPUT_DIR)src\main.asm
Running project pre-build steps
cmd /C echo h\evaluator7t.hld\target.ldsrc\main.csrc\startup_ARMCM7.Ssrc\vectors.S
h\evaluator7t.hld\target.ldsrc\main.csrc\startup_ARMCM7.Ssrc\vectors.S
-------------- Build: default in proj1 (compiler: GNU GCC Compiler for ARM)---------------
arm-none-eabi-gcc.exe -mcpu=arm7tdmi -O2 -Wall -g -fno-common -save-temps -DARM_EVAL7T -D__NO_CTOR_DTOR_SUPPORT__ -g -Isrc -Ih -c src\main.c -o default\src\main.o
src\main.c: In function 'main':
src\main.c:3:11: warning: unused variable 'a' [-Wunused-variable]
short a = add_v1(3, 4);
^
src\main.c: In function '_exit':
src\main.c:20:1: warning: 'noreturn' function does return
}
^
arm-none-eabi-g++.exe -mcpu=arm7tdmi -O2 -Wall -g -fno-common -save-temps -DARM_EVAL7T -D__NO_CTOR_DTOR_SUPPORT__ -g -Isrc -Ih -c src\startup_ARMCM7.S -o default\src\startup_ARMCM7.o
src\startup_ARMCM7.S:7:1: warning: "/*" within comment [-Wcomment]
/* Copyright (c) 2011 - 2014 ARM LIMITED
^
arm-none-eabi-g++.exe -L"C:\Program Files (x86)\GNU Tools ARM Embedded\5.4 2016q3\lib\gcc\arm-none-eabi\5.4.1" -o default\proj1.elf default\src\main.o default\src\startup_ARMCM7.o -s -Wl,-Map,map.txt -mtune=arm7tdmi -T ld/gcc.ld
Output file is default\proj1.elf with size 132.65 KB
Running target post-build steps
arm-none-eabi-objdump -d main1.o > main1.asm
arm-none-eabi-objdump: 'main1.o': No such file
arm-none-eabi-objdump: Warning: '>' is not an ordinary file
arm-none-eabi-objdump: 'main1.asm': No such file
Process terminated with status 1 (0 minute(s), 0 second(s))
0 error(s), 4 warning(s) (0 minute(s), 0 second(s))
Open the project file (.cbp) with a text editor and search for "main1". I guess there are some "remnants" of your tests in the post-build step configuration.
<Build>
<Target title="default">
<Option output="default/proj1.elf" prefix_auto="0" extension_auto="0" />
<Option object_output="default" />
<Option type="1" />
<Option compiler="arm-elf-gcc" />
<Compiler>
<Add option="-g" />
</Compiler>
<Linker>
<Add directory="C:/Program Files (x86)/GNU Tools ARM Embedded/5.4 2016q3/lib/gcc/arm-none-eabi/5.4.1" />
</Linker>
<!-- <ExtraCommands>
<Add after="arm-none-eabi-objdump -d main1.o > main1.asm" />
</ExtraCommands> -->
</Target>
</Build>
Yes, it was exactly the case. It was a strange <ExtraCommands> section that obfuscated the execution of the post-build command.
Once it's commented the post-build works. Is it a bug of Code::Blocks ?
The <ExtraCommands> IS the post-build command. You can set it project-global or target specific. If both have a build command set, you can choose whether the target commands shell be appended to the project commands, or if they shall overwrite the project commands.
According to one of your screenshots, if you select "proj1" in the "Project build options", you can select the project-global build options. These apply usually to all build targets. In your case "default" is the build target. If you select it you can set the target build options. You can also choose how the target options are combined with the project options: They can be appended, prepended, they can replace the project options or they can be ignored (project options only).
You can also choose how the target options are combined with the project options: They can be appended, prepended, they can replace the project options or they can be ignored (project options only).Apparently, I was mistaken. The policies can be applied for e.g. Compiler Settings, Linker Settings etc., but not for the Pre/Post build steps. It seems that the target post-build steps are always executed before the project post-build steps.
BTW: you can switch between project and target settings by selecting the appropriate entry in the tree on the left-hand side...Useful remark. Thanks.
Apparently, I was mistaken. The policies can be applied for e.g. Compiler Settings, Linker Settings etc., but not for the Pre/Post build steps. It seems that the target post-build steps are always executed before the project post-build steps. Hence, if the target post-build fails, the project post-build will not be executed...Yes it's the case ... whatever policy I set, both post-builds commands ("project" and "target") are executed, so if one of them is out of date, it must be removed in order to "up-to-date" version runs.