(toppers-users 4088) Re: TOPPERS/ASP RX62N Configuration
starfieldtrue
starfieldtrue @ gmail.com
2013年 5月 27日 (月) 18:57:47 JST
星野です。
(4)の問題:
ram開始アドレス=1054ならOKだが、
ram開始アドレス=0だとmake dependでリンクエラーになる。
これはstart.Sに以下のセクション属性を追加することで解決しました。
リンカは難しい。
- .section .start1
+ .section .start1,"ax"
########################################################################
"ax"を付けて、リンクできた場合のelfのメモリ配置
$ rx-elf-objdump.exe -h -p cfg1_out.elf
cfg1_out.elf: file format elf32-rx-le
Program Header:
LOAD off 0x00001000 vaddr 0xfff80000 paddr 0xfff80000 align 2**12
filesz 0x0000005e memsz 0x0000005e flags r-x
LOAD off 0x00002000 vaddr 0x00000000 paddr 0xfff80060 align 2**12
filesz 0x00000628 memsz 0x00000628 flags rwx
private flags = 0x0:
Sections:
Idx Name Size VMA LMA File off Algn
0 .tttt 0000005e fff80000 fff80000 00001000 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .dddd 00000628 00000000 fff80060 00002000 2**2
CONTENTS, ALLOC, LOAD, CODE
2 .debug_frame 00000024 00000000 fff80060 00002628 2**2
CONTENTS, READONLY, DEBUGGING
3 .debug_info 00001314 00000000 fff80060 0000264c 2**0
CONTENTS, READONLY, DEBUGGING
4 .debug_abbrev 00000174 00000000 fff80060 00003960 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_aranges 00000020 00000000 fff80060 00003ad4 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_line 00000143 00000000 fff80060 00003af4 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_str 0000183b 00000000 fff80060 00003c37 2**0
CONTENTS, READONLY, DEBUGGING
8 .comment 00000011 00000000 fff80060 00005472 2**0
CONTENTS, READONLY
########################################################################
"ax"を無くして、開始アドレス=0x1054にして強引にリンクした場合
.start1が入るセクション.ttttにALLOC, LOAD, CODE がありません。
$ rx-elf-objdump.exe -h -p cfg1_out.elf
cfg1_out.elf: file format elf32-rx-le
Program Header:
LOAD off 0x00000000 vaddr 0x00000000 paddr 0xfff8000c align 2**12
filesz 0x0000067c memsz 0x0000067c flags rwx
private flags = 0x0:
Sections:
Idx Name Size VMA LMA File off Algn
0 .tttt 0000005e fff80000 fff80000 0000067c 2**1
CONTENTS, READONLY
1 .dddd 00000628 00001054 00001054 00000054 2**2
CONTENTS, ALLOC, LOAD, CODE
2 .debug_frame 00000024 00000000 fff8000c 000006dc 2**2
CONTENTS, READONLY, DEBUGGING
3 .debug_info 00001314 00000000 fff8000c 00000700 2**0
CONTENTS, READONLY, DEBUGGING
4 .debug_abbrev 00000174 00000000 fff8000c 00001a14 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_aranges 00000020 00000000 fff8000c 00001b88 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_line 00000143 00000000 fff8000c 00001ba8 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_str 0000183b 00000000 fff8000c 00001ceb 2**0
CONTENTS, READONLY, DEBUGGING
8 .comment 00000011 00000000 fff8000c 00003526 2**0
CONTENTS, READONLY
以上です。
2013年5月22日 17:40 starfieldtrue <starfieldtrue @ gmail.com>:
> 星野と申します。
>
> 現在RX62N+TOPPERS/ASP+TINETで実験しています。
> TOPPERS動作中にCPU内蔵FLASHへの書き込みをしたいので
> sta_ker以後は全て内蔵RAM上で動作させたいと思っています。
> 内蔵FLASH書き込み中には、それ以外の内蔵FLASHへのアクセスは
> 許容されないため、割り込みが発生しても
> FLASHへのアクセスを避けたいのです。
>
> そこで、リンカスクリプトの記載を変えて試しているのですが、
> 思うようにいきません。もし何かご存知の方がいましたら
> アドバイスを頂けると嬉しいです。
>
> 4タイプの状況を下記に記載します。
> (1)はmake depend; makeは通るが、定数セクション(C)が
> FLASH上に配置されるので上記の要望を満たせない。
> (2)はmake dependは通るがmakeのcfg -pass 3でエラーになる。
> (3)はmake dependのcfg -pass 2でエラーになる。
> (4)はmake dependでリンクエラーになる。
>
> 以下リンカスクリプトについて
> (1),(2),(3),(4)で差異の部分だけ抜粋してあります。
>
> (1)
> MEMORY {
> ram(rwx) : o = 0x00000000, l = 0x00019000
> }
> SECTIONS {
> .text :
> {
> *(.start1) ... start.Sのコードを配置
> *(.start2) ... hardware_init_hookのコードを配置
> *(C) ... 定数データを配置(RX特有のセクション?)
> } >rom
>
> (2)
> MEMORY {
> ram(rwx) : o = 0x00001054, l = 0x00019000
> ... RAM開始アドレスがこれ以上ならば同じ状況になる。
> }
> SECTIONS {
> .text :
> {
> *(.start1)
> *(.start2)
> } >rom
> __idata_start = . ;
> .data : AT(__idata_start)
> {
> __data_start = . ;
> *(C) ... 定数データをRAMに配置するために
> }
>
> (3)
> MEMORY {
> ram(rwx) : o = 0x00001050, l = 0x00019000
> }
> SECTIONS {
> .text :
> {
> *(.start1)
> *(.start2)
> } >rom
> __idata_start = . ;
> .data : AT(__idata_start)
> {
> __data_start = . ;
> *(C) ... 定数データをRAMに配置するために
> }
>
> (4)
> MEMORY {
> ram(rwx) : o = 0x00000000, l = 0x00019000
> }
> SECTIONS {
> .text :
> {
> *(.start1)
> *(.start2)
> } >rom
> __idata_start = . ;
> .data : AT(__idata_start)
> {
> __data_start = . ;
> *(C) ... 定数データをRAMに配置するために
> }
>
> (2)の結果 make dependは通るがmakeのcfg -pass 3でエラーになる。
>
> rx-elf-gcc -falign-functions=2 -Wall -g -O2 -mlittle-endian-data
> -mcpu=RX600 -Wall -g -O2 -DROM_BOOT -DTOPPERS_LABEL_ASM
> -DTARGET_KERNEL_ASP -DSUPPORT_INET4 -DSUPPORT_ETHER -DSUPPORT_TCP
> -DTCP_CFG_LIBRARY -DUDP_CFG_LIBRARY -I. -I../include -I../arch -I..
> -I../target/aprx62n_gcc -I../tinet/netdev/if_rxe -I../tinet -nostdlib
> -nostdlib -Wl,-Map=asp.map -Wl,-EL -T ../arch/rx600_gcc/release.ld -o
> asp.elf \
> echos4.o kernel_cfg_asm.o target_serial.o
> rx600_uart.o net_buf.o net_count.o net_subr.o net_timer.o in_subr.o
> tinet_cfg.o route_cfg.o ip_input.o ip_output.o ip_icmp.o
> tinet_target_config.o if.o ethernet.o if_ether.o if_rxe.o phy.o
> tcp_input.o tcp_output.o tcp_timer.o tcp_subr.o tcp_subr_cs.o
> tcp_subr_ncs.o banner.o syslog.o serial.o logtask.o log_output.o
> vasyslog.o t_perror.o strerror.o kernel_cfg.o libtinet.a -lc
> libkernel.a -lgcc
> rx-elf-nm -C asp.elf > asp.syms
> rx-elf-objcopy -O srec -S asp.elf asp.srec
> ../cfg/cfg/cfg --pass 3 --kernel asp -I. -I../include -I../arch -I..
> -I../target/aprx62n_gcc -I../tinet/netdev/if_rxe -I../tinet \
> --rom-image asp.srec --symbol-table asp.syms \
> -T ../target/aprx62n_gcc/target_check.tf
> --api-table ../kernel/kernel_api.csv --cfg1-def-table
> ../kernel/kernel_def.csv --cfg1-def-table
> ../arch/rx600_gcc/prc_def.csv echos4.cfg
> cfg: S-record data error
> Makefile:322: recipe for target `asp.elf' failed
> make: *** [asp.elf] Error 1
>
> (3)の結果 make dependのcfg -pass 2でエラーになる。
> rx-elf-gcc -falign-functions=2 -Wall -g -O2 -mlittle-endian-data
> -mcpu=RX600 -Wall -g -O2 -DROM_BOOT -DTOPPERS_LABEL_ASM
> -DTARGET_KERNEL_ASP -DSUPPORT_INET4 -DSUPPORT_ETHER -DSUPPORT_TCP
> -DTCP_CFG_LIBRARY -DUDP_CFG_LIBRARY -I. -I../include -I../arch -I..
> -I../target/aprx62n_gcc -I../tinet/netdev/if_rxe -I../tinet -nostdlib
> -nostdlib -Wl,-Map=asp.map -Wl,-EL -T ../arch/rx600_gcc/release.ld
> -o tinet_cfg1_out.elf \
> tinet_cfg1_out.o
> rx-elf-nm -C tinet_cfg1_out.elf > tinet_cfg1_out.syms
> rx-elf-objcopy -O srec -S tinet_cfg1_out.elf tinet_cfg1_out.srec
> ../cfg/cfg/cfg --pass 2 --kernel asp --cfg1_out tinet_cfg1_out -I.
> -I../include -I../arch -I.. -I../target/aprx62n_gcc
> -I../tinet/netdev/if_rxe -I../tinet \
> -T ../tinet/tinet.tf --api-table
> ../tinet/tcpip_api.csv --cfg1-def-table ../kernel/kernel_def.csv
> tinet_echos4.cfg
> cfg: error: magic number is not found in `tinet_cfg1_out.srec/.syms'
> cfg: fatal error
> ../tinet/Makefile.tinet:359: recipe for target `tinet_cfg.c' failed
> make: *** [tinet_cfg.c] Error 1
>
> (4)の結果 make dependでリンクエラーになる。
> rx-elf-gcc -falign-functions=2 -Wall -g -O2 -mlittle-endian-data
> -mcpu=RX600 -Wall -g -O2 -DROM_BOOT -DTOPPERS_LABEL_ASM
> -DTARGET_KERNEL_ASP -DSUPPORT_INET4 -DSUPPORT_ETHER -DSUPPORT_TCP
> -DTCP_CFG_LIBRARY -DUDP_CFG_LIBRARY -I. -I../include -I../arch -I..
> -I../target/aprx62n_gcc -I../tinet/netdev/if_rxe -I../tinet -nostdlib
> -nostdlib -Wl,-Map=asp.map -Wl,-EL -T ../arch/rx600_gcc/release.ld
> -o tinet_cfg1_out.elf \
> tinet_cfg1_out.o
> /usr/local/rx-elf/lib/gcc/rx-elf/4.7.1/../../../../rx-elf/bin/ld:
> tinet_cfg1_out.elf: Not enough room for program headers, try linking
> with -N
> /usr/local/rx-elf/lib/gcc/rx-elf/4.7.1/../../../../rx-elf/bin/ld:
> final link failed: Bad value
> collect2: error: ld returned 1 exit status
> ../tinet/Makefile.tinet:359: recipe for target `tinet_cfg.c' failed
> make: *** [tinet_cfg.c] Error 1
>
>
> 環境は以下です。
> cygwin 1.7.17-1
> rx-elf-gcc (GCC) 4.7.1
>
> PACKAGE asp
> VERSION 1.7.0
>
> PACKAGE cfg
> VERSION 1.6.0
>
> 以上です。