public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* newlib for baremetal m68k coldfire v2 isa-aplus:emac microarchitecture
@ 2014-10-14 12:36 Randy Yates
  2014-10-14 14:31 ` Joel Sherrill
  0 siblings, 1 reply; 2+ messages in thread
From: Randy Yates @ 2014-10-14 12:36 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 4023 bytes --]

I am trying to build newlib for a baremetal Coldfire V2, namely, the
MCF52235CAL60. This is to match the m68k-unknown-elf tools I've recently
built using crosstool-ng.

I built the "vanilla" baremetal m68k toolchain with crosstool-ng using
the unaltered sample, which builds for the cpu32 microarchitecture.
However, I am compiling my code with the -mcpu=52235 option to gcc,
which generates Coldfire V2 code.

I am also doing a fairly "vanilla" newlib configure for the m68k (see
the attached make file).

The problem is that newlib generates code (libc.a and libm.a) for the
cpu32 microarchitecture, while I need the isa-aplus:emac
microarchitecture:

-*- mode: compilation; default-directory: "/home/hvp630-src/nmm-original/Applications/uTaskerV1.4/GNU_ColdFire/" -*-
Compilation started at Mon Oct 13 19:48:27

  make -f utaskerv1p4.mak 
  /home/yates/x-tools/m68k-unknown-elf/bin/m68k-unknown-elf-gcc
-mcpu=52235 -nostartfiles -Wall -Wstrict-prototypes
-I/home/yates/x-tools/m68k-unknown-elf/include
-I/home/hvp630-src/nmm-original/Applications/uTaskerV1.4 -L
/home/yates/x-tools/m68k-unknown-elf/lib/ -D _GNU -D _M5223X -g -Os
-Wl,-Map=uTaskerV1.4.map -Tm5225XUSB-rom.ld -o uTaskerV1.4.elf
Build/application.o Build/debug.o Build/webInterface.o Build/KeyScan.o
Build/GLCD.o Build/LCD.o Build/NetworkIndicator.o
Build/usb_application.o Build/MODBUS.o Build/modbus_app.o
Build/Startup_gnu.o Build/M5223X.o Build/eth_drv.o Build/iic_drv.o
Build/Driver.o Build/uMalloc.o Build/uTasker.o Build/Tty_drv.o
Build/uFile.o Build/Watchdog.o Build/GlobalTimer.o Build/USB_drv.o
Build/low_power.o Build/can_drv.o Build/Ethernet.o Build/arp.o
Build/dhcp.o Build/dns.o Build/ftp.o Build/http.o Build/icmp.o
Build/ip_utils.o Build/ip.o Build/pop3.o Build/smtp.o Build/tcp.o
Build/telnet.o Build/tftp.o Build/udp.o Build/webutils.o
Build/NetBIOS.o Build/snmp.o
  /home/yates/x-tools/m68k-unknown-elf/m68k-unknown-elf/bin/ld.real: m68k:cpu32 architecture of input file `/home/yates/x-tools/m68k-unknown-elf/lib//libc.a(lib_a-strcat.o)' is incompatible with m68k:isa-aplus:emac output
  /home/yates/x-tools/m68k-unknown-elf/m68k-unknown-elf/bin/ld.real: m68k:cpu32 architecture of input file `/home/yates/x-tools/m68k-unknown-elf/lib//libc.a(lib_a-strcmp.o)' is incompatible with m68k:isa-aplus:emac output
  /home/yates/x-tools/m68k-unknown-elf/m68k-unknown-elf/bin/ld.real: m68k:cpu32 architecture of input file `/home/yates/x-tools/m68k-unknown-elf/lib//libc.a(lib_a-strcpy.o)' is incompatible with m68k:isa-aplus:emac output
  /home/yates/x-tools/m68k-unknown-elf/m68k-unknown-elf/bin/ld.real: m68k:cpu32 architecture of input file `/home/yates/x-tools/m68k-unknown-elf/lib//libc.a(lib_a-strlen.o)' is incompatible with m68k:isa-aplus:emac output
  Build/application.o: In function `fnApplication':
  /home/hvp630-src/nmm-original/Applications/uTaskerV1.4/GNU_ColdFire/../application.c:920: undefined reference to `fnStartBP5_Server'
  Build/webInterface.o: In function `fnHandleWeb':
  webInterface.c:(.text+0x112c): undefined reference to `setBP5ArrayParameter'
  Build/M5223X.o: In function `_IIC_Interrupt':
  /home/hvp630-src/nmm-original/Applications/uTaskerV1.4/GNU_ColdFire/../../../Hardware/M5223X/M5223X.c:3311: undefined reference to `ucRx'
  Build/M5223X.o:(.rodata+0xf6): undefined reference to `fnBP5'
  Build/Tty_drv.o: In function `fnSciRxByte':
  Tty_drv.c:(.text+0x9f6): undefined reference to `ParseNextLetter'
  Build/http.o: In function `fnDoWebPage':
  http.c:(.text+0x640): undefined reference to `getBP5SerialNumberLength'
  http.c:(.text+0x666): undefined reference to `getBP5SerialNumber'
  collect2: error: ld returned 1 exit status
  make: *** [uTaskerV1.4.elf] Error 1
  
  Compilation exited abnormally with code 2 at Mon Oct 13 19:48:27

My question is this: How can I build newlib for the m68k so that the
libc.a and libm.a libraries are generated using the isa-aplus:emac
microarchitecture instead of the cpu32 microarchitecture?
-- 
Randy Yates
Digital Signal Labs
http://www.digitalsignallabs.com

[-- Attachment #2: newlib.mak --]
[-- Type: application/octet-stream, Size: 3039 bytes --]

MAKEFLAGS += --no-print-directory
PLATFORM += linux
MACHINE += m68k
VENDOR += unknown
#OPERATINGSYSTEM = eabi
OPERATINGSYSTEM = elf
TARGET += $(MACHINE)-$(VENDOR)-$(OPERATINGSYSTEM)
HOST += x86_64-redhat-linux
BUILD += $(HOST)
PREFIX += $(HVP630_SRC_PROJECT_ROOT_DIR)tool/$(PLATFORM)/$(TARGET)
SYSROOT += $(PREFIX)
GNU_NEWLIB_VERSION += 1.20.0
GNU_NEWLIB_STEM = newlib-$(GNU_NEWLIB_VERSION)
SRCDIR += $(HVP630_SRC_PROJECT_ROOT_DIR)tool/$(GNU_NEWLIB_STEM)/
GNU_NEWLIB_BUILD_PATH = ./build-newlib/
GNU_NEWLIB_UNPACK_NAME = .has-been-unpacked
GNU_NEWLIB_CONFIGURE_NAME = .has-been-configured
GNU_NEWLIB_MAKE_NAME = .has-been-maked
GNU_NEWLIB_INSTALL_NAME = .has-been-installed

PATH := /home/yates/x-tools/m68k-unknown-elf/bin:$(PATH)

PHONY += all
all : download unpack configure make install

PHONY += download
download : ./$(GNU_NEWLIB_STEM).tar.gz

PHONY += unpack
unpack : ./$(GNU_NEWLIB_STEM)/$(GNU_NEWLIB_UNPACK_NAME)

PHONY += configure
configure : $(GNU_NEWLIB_BUILD_PATH)$(GNU_NEWLIB_CONFIGURE_NAME)

PHONY += make
make : $(GNU_NEWLIB_BUILD_PATH)$(GNU_NEWLIB_MAKE_NAME)

PHONY += install
make : $(GNU_NEWLIB_BUILD_PATH)$(GNU_NEWLIB_INSTALL_NAME)

./$(GNU_NEWLIB_STEM).tar.gz :
	@echo "** downloading $(@)..."
	-rm $(@)
	wget ftp://sourceware.org/pub/newlib/$(GNU_NEWLIB_STEM).tar.gz 

./$(GNU_NEWLIB_STEM)/$(GNU_NEWLIB_UNPACK_NAME) : ./$(GNU_NEWLIB_STEM).tar.gz
	@echo " unpacking $(@)..."
	-rm -fR $(@)
	@tar -xzvf $^
	echo "" > ./$(GNU_NEWLIB_STEM)/$(GNU_NEWLIB_UNPACK_NAME)

$(GNU_NEWLIB_BUILD_PATH)$(GNU_NEWLIB_CONFIGURE_NAME) : ./$(GNU_NEWLIB_STEM)/$(GNU_NEWLIB_UNPACK_NAME) 
	mkdir -p $(GNU_NEWLIB_BUILD_PATH)$
	cd $(GNU_NEWLIB_BUILD_PATH); $(SRCDIR)configure --prefix=$(PREFIX) --target=$(TARGET) $(HOST) CC_FOR_TARGET=$(TARGET)-gcc
#	cd $(GNU_NEWLIB_BUILD_PATH)$; ./configure --with-arch=cf --target=$(TARGET) --host=$(HOST) --with-sysroot=$(SYSROOT) --build=$(BUILD) --prefix=$(PREFIX) --disable-nls --disable-werror
	echo "" > $(GNU_NEWLIB_BUILD_PATH)$(GNU_NEWLIB_CONFIGURE_NAME)

$(GNU_NEWLIB_BUILD_PATH)$(GNU_NEWLIB_MAKE_NAME) : $(GNU_NEWLIB_BUILD_PATH)$(GNU_NEWLIB_CONFIGURE_NAME)
	cd $(GNU_NEWLIB_BUILD_PATH); make 
	echo "" > $(GNU_NEWLIB_BUILD_PATH)$(GNU_NEWLIB_MAKE_NAME)

$(GNU_NEWLIB_BUILD_PATH)$(GNU_NEWLIB_INSTALL_NAME) : $(GNU_NEWLIB_BUILD_PATH)$(GNU_NEWLIB_MAKE_NAME)
	cd $(GNU_NEWLIB_BUILD_PATH); make install-target-newlib
	cd $(GNU_NEWLIB_BUILD_PATH); make install-target-libgloss

#----------------------------------------------------------------------------------------
PHONY += clean
clean :
	@echo "** cleaning $(TARGET)"
	-cd ./$(GNU_NEWLIB_STEM); make clean
	-rm -fR ./$(GNU_NEWLIB_STEM) 
	-rm -fR $(GNU_NEWLIB_BUILD_PATH) 
	-rm wget-log

clean-configure :
	-rm $(GNU_NEWLIB_BUILD_PATH)$(GNU_NEWLIB_CONFIGURE_NAME)

clean-make :
	-rm $(GNU_NEWLIB_BUILD_PATH)$(GNU_NEWLIB_MAKE_NAME)

clean-install :
	-rm $(GNU_NEWLIB_BUILD_PATH)$(GNU_NEWLIB_INSTALL_NAME)

PHONY += cleanall
cleanall : clean
	@echo "** cleaning all $(TARGET)"
	-rm ./$(GNU_NEWLIB_STEM).tar.gz

.PHONY : $(PHONY)

test :
	echo $(PATH)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: newlib for baremetal m68k coldfire v2 isa-aplus:emac microarchitecture
  2014-10-14 12:36 newlib for baremetal m68k coldfire v2 isa-aplus:emac microarchitecture Randy Yates
@ 2014-10-14 14:31 ` Joel Sherrill
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Sherrill @ 2014-10-14 14:31 UTC (permalink / raw)
  To: Randy Yates, newlib


On 10/14/2014 7:36 AM, Randy Yates wrote:
> I am trying to build newlib for a baremetal Coldfire V2, namely, the
> MCF52235CAL60. This is to match the m68k-unknown-elf tools I've recently
> built using crosstool-ng.
>
> I built the "vanilla" baremetal m68k toolchain with crosstool-ng using
> the unaltered sample, which builds for the cpu32 microarchitecture.
> However, I am compiling my code with the -mcpu=52235 option to gcc,
> which generates Coldfire V2 code.
FWIW m68k-rtems in gcc adds more an extra gcc/config/m68k/t-* file compared
to m68k-elf. We have BSPs for the 52235 and various other Coldfires. It
is quite
possible that this variant is matched better in m68k-rtems than m68k-elf.

You could try a build of gcc with this addressed in gcc/config.gcc. If
so, it may
make sense to merge config/m68k/t-rtems into a file shared with m68k-elf.
> I am also doing a fairly "vanilla" newlib configure for the m68k (see
> the attached make file).
>
> The problem is that newlib generates code (libc.a and libm.a) for the
> cpu32 microarchitecture, while I need the isa-aplus:emac
> microarchitecture:
>
> -*- mode: compilation; default-directory: "/home/hvp630-src/nmm-original/Applications/uTaskerV1.4/GNU_ColdFire/" -*-
> Compilation started at Mon Oct 13 19:48:27
>
>   make -f utaskerv1p4.mak 
>   /home/yates/x-tools/m68k-unknown-elf/bin/m68k-unknown-elf-gcc
> -mcpu=52235 -nostartfiles -Wall -Wstrict-prototypes
> -I/home/yates/x-tools/m68k-unknown-elf/include
> -I/home/hvp630-src/nmm-original/Applications/uTaskerV1.4 -L
> /home/yates/x-tools/m68k-unknown-elf/lib/ -D _GNU -D _M5223X -g -Os
> -Wl,-Map=uTaskerV1.4.map -Tm5225XUSB-rom.ld -o uTaskerV1.4.elf
> Build/application.o Build/debug.o Build/webInterface.o Build/KeyScan.o
> Build/GLCD.o Build/LCD.o Build/NetworkIndicator.o
> Build/usb_application.o Build/MODBUS.o Build/modbus_app.o
> Build/Startup_gnu.o Build/M5223X.o Build/eth_drv.o Build/iic_drv.o
> Build/Driver.o Build/uMalloc.o Build/uTasker.o Build/Tty_drv.o
> Build/uFile.o Build/Watchdog.o Build/GlobalTimer.o Build/USB_drv.o
> Build/low_power.o Build/can_drv.o Build/Ethernet.o Build/arp.o
> Build/dhcp.o Build/dns.o Build/ftp.o Build/http.o Build/icmp.o
> Build/ip_utils.o Build/ip.o Build/pop3.o Build/smtp.o Build/tcp.o
> Build/telnet.o Build/tftp.o Build/udp.o Build/webutils.o
> Build/NetBIOS.o Build/snmp.o
>   /home/yates/x-tools/m68k-unknown-elf/m68k-unknown-elf/bin/ld.real: m68k:cpu32 architecture of input file `/home/yates/x-tools/m68k-unknown-elf/lib//libc.a(lib_a-strcat.o)' is incompatible with m68k:isa-aplus:emac output
>   /home/yates/x-tools/m68k-unknown-elf/m68k-unknown-elf/bin/ld.real: m68k:cpu32 architecture of input file `/home/yates/x-tools/m68k-unknown-elf/lib//libc.a(lib_a-strcmp.o)' is incompatible with m68k:isa-aplus:emac output
>   /home/yates/x-tools/m68k-unknown-elf/m68k-unknown-elf/bin/ld.real: m68k:cpu32 architecture of input file `/home/yates/x-tools/m68k-unknown-elf/lib//libc.a(lib_a-strcpy.o)' is incompatible with m68k:isa-aplus:emac output
>   /home/yates/x-tools/m68k-unknown-elf/m68k-unknown-elf/bin/ld.real: m68k:cpu32 architecture of input file `/home/yates/x-tools/m68k-unknown-elf/lib//libc.a(lib_a-strlen.o)' is incompatible with m68k:isa-aplus:emac output
>   Build/application.o: In function `fnApplication':
>   /home/hvp630-src/nmm-original/Applications/uTaskerV1.4/GNU_ColdFire/../application.c:920: undefined reference to `fnStartBP5_Server'
>   Build/webInterface.o: In function `fnHandleWeb':
>   webInterface.c:(.text+0x112c): undefined reference to `setBP5ArrayParameter'
>   Build/M5223X.o: In function `_IIC_Interrupt':
>   /home/hvp630-src/nmm-original/Applications/uTaskerV1.4/GNU_ColdFire/../../../Hardware/M5223X/M5223X.c:3311: undefined reference to `ucRx'
>   Build/M5223X.o:(.rodata+0xf6): undefined reference to `fnBP5'
>   Build/Tty_drv.o: In function `fnSciRxByte':
>   Tty_drv.c:(.text+0x9f6): undefined reference to `ParseNextLetter'
>   Build/http.o: In function `fnDoWebPage':
>   http.c:(.text+0x640): undefined reference to `getBP5SerialNumberLength'
>   http.c:(.text+0x666): undefined reference to `getBP5SerialNumber'
>   collect2: error: ld returned 1 exit status
>   make: *** [uTaskerV1.4.elf] Error 1
>   
>   Compilation exited abnormally with code 2 at Mon Oct 13 19:48:27
>
> My question is this: How can I build newlib for the m68k so that the
> libc.a and libm.a libraries are generated using the isa-aplus:emac
> microarchitecture instead of the cpu32 microarchitecture?

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill@OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-14 14:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-14 12:36 newlib for baremetal m68k coldfire v2 isa-aplus:emac microarchitecture Randy Yates
2014-10-14 14:31 ` Joel Sherrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).