2008-08-06 09:47:37 Adding Support for a New Board
Ben Matthews (UNITED STATES)
Message: 60038
I'm trying to add support for a custom board to the kernel and I'm having trouble getting it to build. Until recently I've been just adjusting the BF533-STAMP profile as needed, but it would be nice to get it separated and submitted for inclusion in the distribution. I followed the instructions on the Wiki, using my known working version of arch/blackfin/mach-bf533/boards/stamp.c and simply renaming it and adding it to the Makefiles/Kconfig. When I try to build it (using a configuration which builds fine and only changing the "System Type" option) arch/blackfin/mach-bf533/head.S fails to assemble:
AS arch/blackfin/mach-bf533/head.o
arch/blackfin/mach-bf533/head.S: Assembler messages:
arch/blackfin/mach-bf533/head.S:389: Error: reloc 582 not supported by object file format
arch/blackfin/mach-bf533/head.S:389: Error: reloc 583 not supported by object file format
arch/blackfin/mach-bf533/head.S:389: Error: reloc 586 not supported by object file format
arch/blackfin/mach-bf533/head.S:389: Error: reloc 582 not supported by object file format
arch/blackfin/mach-bf533/head.S:389: Error: reloc 587 not supported by object file format
arch/blackfin/mach-bf533/head.S:389: Error: reloc 582 not supported by object file format
arch/blackfin/mach-bf533/head.S:389: Error: reloc 582 not supported by object file format
arch/blackfin/mach-bf533/head.S:389: Error: reloc 584 not supported by object file format
arch/blackfin/mach-bf533/head.S:389: Error: reloc 585 not supported by object file format
arch/blackfin/mach-bf533/head.S:408: Error: reloc 582 not supported by object file format
arch/blackfin/mach-bf533/head.S:408: Error: reloc 583 not supported by object file format
arch/blackfin/mach-bf533/head.S:408: Error: reloc 592 not supported by object file format
arch/blackfin/mach-bf533/head.S:408: Error: reloc 582 not supported by object file format
arch/blackfin/mach-bf533/head.S:408: Error: reloc 592 not supported by object file format
arch/blackfin/mach-bf533/head.S:408: Error: reloc 582 not supported by object file format
arch/blackfin/mach-bf533/head.S:408: Error: reloc 592 not supported by object file format
arch/blackfin/mach-bf533/head.S:408: Error: reloc 582 not supported by object file format
arch/blackfin/mach-bf533/head.S:408: Error: reloc 592 not supported by object file format
arch/blackfin/mach-bf533/head.S:408: Error: reloc 582 not supported by object file format
arch/blackfin/mach-bf533/head.S:408: Error: reloc 592 not supported by object file format
arch/blackfin/mach-bf533/head.S:408: Error: reloc 583 not supported by object file format
arch/blackfin/mach-bf533/head.S:408: Error: reloc 592 not supported by object file format
arch/blackfin/mach-bf533/head.S:408: Error: reloc 583 not supported by object file format
arch/blackfin/mach-bf533/head.S:408: Error: reloc 591 not supported by object file format
arch/blackfin/mach-bf533/head.S:409: Error: reloc 582 not supported by object file format
arch/blackfin/mach-bf533/head.S:409: Error: reloc 583 not supported by object file format
arch/blackfin/mach-bf533/head.S:409: Error: reloc 592 not supported by object file format
arch/blackfin/mach-bf533/head.S:409: Error: reloc 582 not supported by object file format
arch/blackfin/mach-bf533/head.S:409: Error: reloc 592 not supported by object file format
arch/blackfin/mach-bf533/head.S:409: Error: reloc 582 not supported by object file format
arch/blackfin/mach-bf533/head.S:409: Error: reloc 592 not supported by object file format
arch/blackfin/mach-bf533/head.S:409: Error: reloc 582 not supported by object file format
arch/blackfin/mach-bf533/head.S:409: Error: reloc 592 not supported by object file format
arch/blackfin/mach-bf533/head.S:409: Error: reloc 582 not supported by object file format
arch/blackfin/mach-bf533/head.S:409: Error: reloc 592 not supported by object file format
arch/blackfin/mach-bf533/head.S:409: Error: reloc 583 not supported by object file format
arch/blackfin/mach-bf533/head.S:409: Error: reloc 592 not supported by object file format
arch/blackfin/mach-bf533/head.S:409: Error: reloc 583 not supported by object file format
arch/blackfin/mach-bf533/head.S:409: Error: reloc 590 not supported by object file format
arch/blackfin/mach-bf533/head.S:409: Error: reloc 583 not supported by object file format
arch/blackfin/mach-bf533/head.S:409: Error: reloc 591 not supported by object file format
What am I doing wrong? I'm using the latest GIT kernel and the 2008R1.5 toolchain
QuoteReplyEditDelete
2008-08-06 13:30:18 Re: Adding Support for a New Board
Mike Frysinger (UNITED STATES)
Message: 60050
maybe your CPU hasnt been selected properly. those errors generally mean that what should have been expanded as defines have instead been expanded as symbols (because the compiler/includes did not properly pull in the expected headers).
run with V=1 to check the compilation line. also, if you really dont need "reprogram kernel clocks", then simply dont enable that kconfig option.
QuoteReplyEditDelete
2008-08-06 14:57:04 Re: Adding Support for a New Board
Ben Matthews (UNITED STATES)
Message: 60053
It does work ok with the "reporgram kernel clocks" option off. I guess I can make u-boot take care of that but it would be nice to have the kernel do it. To eliminate as many variables as possible, I also tried using an unmodified stamp.c (renamed only) and I'm seeing the same result. The compilation line looks ok to me:
bfin-uclinux-gcc -Wp,-MD,arch/blackfin/mach-bf533/.head.o.d -nostdinc -isystem /opt/uClinux/bfin-uclinux/lib/gcc/bfin-uclinux/4.1.2/include -D__KERNEL__ -Iinclude -include include/linux/autoconf.h -D__ASSEMBLY__ -mno-fdpic -mcpu=bf533-0.5 -c -o arch/blackfin/mach-bf533/head.o arch/blackfin/mach-bf533/head.S
arch/blackfin/mach-bf533/head.S: Assembler messages:
arch/blackfin/mach-bf533/head.S:389: Error: reloc 582 not supported by object file format
... Similar Errors to those listed before
If I change the CPU type to the bf-532 (my actual target cpu) the change is reflected in the compiler call:
bfin-uclinux-gcc -Wp,-MD,arch/blackfin/mach-bf533/.head.o.d -nostdinc -isystem /opt/uClinux/bfin-uclinux/lib/gcc/bfin-uclinux/4.1.2/include -D__KERNEL__ -Iinclude -include include/linux/autoconf.h -D__ASSEMBLY__ -mno-fdpic -mcpu=bf532-0.5 -c -o arch/blackfin/mach-bf533/head.o arch/blackfin/mach-bf533/head.S
arch/blackfin/mach-bf533/head.S: Assembler messages:
arch/blackfin/mach-bf533/head.S:389: Error: reloc 582 not supported by object file format
For the sake of this test I have made the following changes to the current SVN kernel (as of this morning anyway) as output by git-diff
diff --git a/arch/blackfin/mach-bf533/boards/Kconfig b/arch/blackfin/mach-bf533/boards/Kconfig
index 8400592..5161e4a 100644
--- a/arch/blackfin/mach-bf533/boards/Kconfig
+++ b/arch/blackfin/mach-bf533/boards/Kconfig
@@ -31,6 +31,13 @@ config BFIN532_IP0X
depends on (BF532)
help
Core support for IP04/IP04 open hardware IP-PBX.
+config BLACKSTAMP_BF532
+ bool "BlackStamp BF-532"
+# depends on (BF532)
+ help
+ Support for the BlackStamp Board. Schematics and Layouts
+ Freely Available from
+ http://blackfin.uclinux.org/gf/project/blackstamp/
config GENERIC_BF533_BOARD
bool "Generic"
diff --git a/arch/blackfin/mach-bf533/boards/Makefile b/arch/blackfin/mach-bf533/boards/Makefile
index b7a1a1d..b7544af 100644
--- a/arch/blackfin/mach-bf533/boards/Makefile
+++ b/arch/blackfin/mach-bf533/boards/Makefile
@@ -8,3 +8,4 @@ obj-$(CONFIG_BFIN532_IP0X) += ip0x.o
obj-$(CONFIG_BFIN533_EZKIT) += ezkit.o
obj-$(CONFIG_BFIN533_BLUETECHNIX_CM) += cm_bf533.o
obj-$(CONFIG_H8606_HVSISTEMAS) += H8606.o
+obg-$(CONFIG_BLACKSTAMP_BF532) += blackstamp.o
diff --git a/arch/blackfin/mach-bf533/boards/blackstamp.c b/arch/blackfin/mach-bf533/boards/blackstamp.c
new file mode 100644
index 0000000..4e999e1
--- /dev/null
+++ b/arch/blackfin/mach-bf533/boards/blackstamp.c
@@ -0,0 +1,646 @@
and I copied arch/blackfin/mach-bf533/boards/stamp.c to arch/blackfin/mach-bf533/boards/blackstamp.c (too long to paste here)
Thanks for the tip about using make V=1
What (else) am I doing wrong?
QuoteReplyEditDelete
2008-08-08 11:03:14 Re: Adding Support for a New Board
Mike Frysinger (UNITED STATES)
Message: 60177
your boards/Makefile is incorrect ... you used "obg" instead of "obj"
the problem is probably that you did not select a proper memory type for your board, so defines in mem_init.h are not being expanded to numbers
you can run this and review the assembly: make arch/blackfin/mach-bf533/head.s
QuoteReplyEditDelete
2008-08-08 15:17:34 Re: Adding Support for a New Board
Ben Matthews (UNITED STATES)
Message: 60186
If that command did what I think it did it (ran only the preprocessor on head.S) looks like you are correct about the memory type selection (I don't remember defining it anywhere either). A bunch of symbols beginning with SDRAM aren't resolving to numbers. It looks like I have to define (in my board's case) CONFIG_MEM_MT48LC32M16A2TG_75 at least. Where should these memory options be defined? I can't seem to find where any of the other boards are defining these settings (using find, grep and menuconfig at least).
the obg/obj problem is probably an artifact from copying/pasting, it is correct in the code I'm using.
Thanks for all your help so far.
QuoteReplyEditDelete
2008-08-08 16:33:31 Re: Adding Support for a New Board
Mike Frysinger (UNITED STATES)
Message: 60188
the mem_init.h situation is a bit murky if you arent "in the know". if you have MEM_MT48LC32M16A2TG_75, then you should have an easy time of things. just update the arch/blackfin/Kconfig and add your board to the depend list for MEM_MT48LC32M16A2TG_75.
you may also want to tweak the default value for CLKIN_HZ and VCO_MULT.
also, make sure you delete the head.s manually.
QuoteReplyEditDelete
2008-08-08 16:54:03 Re: Adding Support for a New Board
Ben Matthews (UNITED STATES)
Message: 60190
"In the know" I am not, unfortunately. I'm a long time Linux user, but this is my first real attempt at kernel hacking ;-). It looks like one of these days I need to sit down an try to understand the kernel build system.
Anyway, that fixed it and things seem to be compiling ok now so I can proceed with setting up the rest of the configuration. Is there anywhere other than the arch/blackfin/configs to tweak CLKIN_HZ and the other timing options? The defaults are definitely inappropriate for our board.
It would probably be helpful for others if there was a mention of this situation on the wiki.
Thanks again
QuoteReplyEditDelete
2008-08-08 17:13:03 Re: Adding Support for a New Board
Mike Frysinger (UNITED STATES)
Message: 60191
this is a Blackfin-specific piece, so i wouldnt worry about it once it starts working
all board defaults are in your defconfig in arch/blackfin/configs/ and the Kconfig above that