Andes Workshop
http://forum.andestech.com/

Cut section (objcopy option -R)
http://forum.andestech.com/viewtopic.php?f=25&t=811
Page 1 of 1

Author:  cindy [ Thu Mar 06, 2014 11:38 pm ]
Post subject:  Cut section (objcopy option -R)

This is a example:
Attachment:
3.png
3.png [ 34.75 KiB | Viewed 5843 times ]

The bin file is from 0x0~0x30004, size is 0x30004 bytes. (196612 bytes)
Attachment:
2.png
2.png [ 46.21 KiB | Viewed 5844 times ]

Sample code:
Attachment:
cut-section-original.zip [22.35 KiB]
Downloaded 245 times

----------------------------------------------------------------
Remove the last section .section2 from bin file.
The new bin file is from 0x0~0x2004, size is 0x2004 bytes. (8196 bytes)
Command:
nds32le-elf-objcopy -S -O binary -R .section2 "cut-section-remove.adx" output/cut-section-remove.bin

AndeSight setting:
Attachment:
6.png
6.png [ 70.22 KiB | Viewed 5843 times ]

Attachment:
5.png
5.png [ 33.52 KiB | Viewed 5843 times ]


Attachment:
4.png
4.png [ 31.76 KiB | Viewed 5843 times ]

Sample:
Attachment:
cut-section-remove.zip [22.18 KiB]
Downloaded 256 times

Author:  cindy [ Fri Mar 21, 2014 3:36 pm ]
Post subject:  Re: Cut section (objcopy option -R)

Another way:
Set .mybss as "@nobits!".
Code:
__attribute__((section(".mybss, \"aw\", @nobits!")))

Author:  cindy [ Tue Aug 12, 2014 11:09 am ]
Post subject:  Re: Cut section (objcopy option -R)

If you want only copy section, you can use -j option
-j --only-section <name> Only copy section <name> into the output
Attachment:
_j.png
_j.png [ 48.58 KiB | Viewed 5563 times ]

Author:  ianfeng [ Tue Aug 12, 2014 11:20 am ]
Post subject:  Re: Cut section (objcopy option -R)

Only output specific section .section1 from .adx file to .bin file.

Only section command:
nds32le-elf-objcopy -S -O binary -j .section1 "cut-section-remove.adx" output/only-section1.bin

The output "only-section1.bin" will be 0x000004d2 = 1234.

Page 1 of 1 All times are UTC + 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/