Development around Coldfire
Hello,
The work enclosed in the patches is not fully-working yet, but I wanted to share it so that others can help, and to avoid others in trying to do the same thing.
Basically, the goal of this patch set is to add a defconfig for the MCF5208 Coldfire platform emulated by Qemu, which is a non-MMU platform.
The proposed defconfig generates a system where the kernel boots, but panics when the first userspace program exits (the kernel complains that someone tried to kill init).
I think patches 1 to 4 could be merged now, while the 5th patch (adding the defconfig) needs more work to fix this problem before being submitted. The other annoying part is that a patch for Qemu is also needed (it is part of this 5th patch).
Note that I have also done a similar work on the AT91 ARM noMMU platform emulated by SkyEye. I hope to send the patches soon.
Thomas
The following changes since commit 8876b6751e0bc19a3754290061808f0f8420708e:
Fix makedevs to allow longer path names (2012-04-08 19:46:52 +0200)
are available in the git repository at:
git://git.free-electrons.com/users/thomas-petazzoni/buildroot.git for-2012.05/coldfire
Thomas Petazzoni (5):
arch: re-enable m68k and add a few architecture variants
toolchain: add Coldfire external toolchain from Sourcery CodeBench
toolchain: add m68k to the list of arch that can work without MMU
busybox: enable useful hush suboptions
board: add support for Coldfire MCF5208EVB board emulated by Qemu
.../qemu/m68k-mcf5208evb/linux-3.3-sw-ustack.patch | 25 +++++++ board/qemu/m68k-mcf5208evb/linux-3.3.config | 71 ++++++++++++++++++++ .../qemu-mcfint-masking-support.patch | 42 ++++++++++++ board/qemu/m68k-mcf5208evb/readme.txt | 14 ++++ configs/qemu_m68k_mcf5208_evb_defconfig | 14 ++++ package/busybox/busybox.mk | 5 ++ target/Config.in.arch | 41 +++++++++++- toolchain/toolchain-common.in | 2 +- toolchain/toolchain-external/Config.in | 41 +++++++++++ toolchain/toolchain-external/ext-tool.mk | 3 + 10 files changed, 256 insertions(+), 2 deletions(-) create mode 100644 board/qemu/m68k-mcf5208evb/linux-3.3-sw-ustack.patch create mode 100644 board/qemu/m68k-mcf5208evb/linux-3.3.config create mode 100644 board/qemu/m68k-mcf5208evb/qemu-mcfint-masking-support.patch create mode 100644 board/qemu/m68k-mcf5208evb/readme.txt create mode 100644 configs/qemu_m68k_mcf5208_evb_defconfig
Thanks,
Signature · 1 line
Thomas Petazzoni
PATCH 1/5 arch: re-enable m68k and add a few architecture variants
--- target/Config.in.arch | 41 ++++++++++++++++++++++++++++++++++++++++- 1 files changed, 40 insertions(+), 1 deletions(-)
target/Config.in.arch +40 -1
@@ -48,7 +48,6 @@ config BR2_i386 config BR2_m68k bool "m68k" - depends on BROKEN # ice in uclibc / inet_ntoa_r help Motorola 68000 family microprocessor http://en.wikipedia.org/wiki/M68k
@@ -577,6 +576,40 @@ config BR2_powerpc_SPE depends on BR2_powerpc_8540 || BR2_powerpc_8548 || BR2_powerpc_e500mc endchoice +choice + prompt "Target Architecture Variant" + depends on BR2_m68k + default BR2_generic_m68k + help + Specific CPU variant to use +config BR2_generic_m68k + bool "generic" +config BR2_m68k_68000 + bool "m68k 68000" +config BR2_m68k_68010 + bool "m68k 68010" +config BR2_m68k_68020 + bool "m68k 68020" +config BR2_m68k_68030 + bool "m68k 68030" +config BR2_m68k_68040 + bool "m68k 68030" +config BR2_m68k_68060 + bool "m68k 68030" +config BR2_m68k_5206 + bool "coldfire 5206" +config BR2_m68k_51qe + bool "coldfire 51qe" +config BR2_m68k_5206e + bool "coldfire 5206e" +config BR2_m68k_5208 + bool "coldfire 5208" +config BR2_m68k_5307 + bool "coldfire 5307" +config BR2_m68k_5407 + bool "coldfire 5407" +endchoice + config BR2_ARCH string default "arm" if BR2_arm
@@ -845,3 +878,9 @@ config BR2_GCC_TARGET_CPU default sparchfleonv8 if BR2_sparc_sparchfleonv8 default sparcsfleon if BR2_sparc_sparcsfleon default sparcsfleonv8 if BR2_sparc_sparcsfleonv8 + default 5206 if BR2_m68k_5206 + default 51qe if BR2_m68k_51qe + default 5206e if BR2_m68k_5206e + default 5208 if BR2_m68k_5208 + default 5307 if BR2_m68k_5307 + default 5407 if BR2_m68k_5407
Signature · 1 line
1.7.4.1
PATCH 2/5 toolchain: add Coldfire external toolchain from Sourcery CodeBench
In reply to Thomas Petazzoni--- toolchain/toolchain-external/Config.in | 41 ++++++++++++++++++++++++++++++ toolchain/toolchain-external/ext-tool.mk | 3 ++ 2 files changed, 44 insertions(+), 0 deletions(-)
toolchain/toolchain-external/Config.in +41 -0
@@ -470,6 +470,46 @@ config BR2_TOOLCHAIN_EXTERNAL_XILINX_MICROBLAZEBE_V2 Toolchain for the Microblaze architecture, from http://wiki.xilinx.com/mb-gnu-tools +config BR2_TOOLCHAIN_EXTERNAL_SOURCERY_CODEBENCH_FREESCALE_COLDFIRE_201109 + bool "Sourcery CodeBench Freescale Coldfire 2011.09" + depends on BR2_m68k + select BR2_TOOLCHAIN_EXTERNAL_UCLIBC + select BR2_INSTALL_LIBSTDCPP + select BR2_LARGEFILE + select BR2_INET_RPC + select BR2_USE_WCHAR + select BR2_TOOLCHAIN_HAS_THREADS + select BR2_TOOLCHAIN_HAS_THREADS_DEBUG + help + Sourcery CodeBench toolchain for the m68k Coldfire + architecture, from Mentor Graphics. It uses gcc 4.6.1, + binutils 2.21.53, uClibc 0.9.30, gdb 7.2.50 and kernel + headers 3.0.1. It has support for the following variants: + - MCF5206 + - MCF51QE + - MCF5206E + - MCF5208 + - MCF5307 + - MCF532X/7X + - MCF5407 + - MCF54455 + - MCF5206, with separated data + - MCF5206, with ID-shared-library + - MCF51QE, with separated data + - MCF51QE, with ID-shared-library + - MCF5206E, with separated data + - MCF5206E, with ID-shared-library + - MCF5208, with separated data + - MCF5208, with ID-shared-library + - MCF5307, with separated data + - MCF5307, with ID-shared-library + - MCF532X/7X, with separated data + - MCF532X/7X, with ID-shared-library + - MCF5407, with separated data + - MCF5407, with ID-shared-library + - MCF54455, with separated data + - MCF54455, with ID-shared-library + config BR2_TOOLCHAIN_EXTERNAL_CUSTOM bool "Custom toolchain" help
@@ -525,6 +565,7 @@ config BR2_TOOLCHAIN_EXTERNAL_PREFIX default "bfin-linux-uclibc" if BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2010RC1 && BR2_BFIN_FDPIC default "bfin-uclinux" if BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2011R1 && !BR2_BFIN_FDPIC default "bfin-linux-uclibc" if BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2011R1 && BR2_BFIN_FDPIC + default "m68k-uclinux" if BR2_TOOLCHAIN_EXTERNAL_SOURCERY_CODEBENCH_FREESCALE_COLDFIRE_201109 default $(BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX) \ if BR2_TOOLCHAIN_EXTERNAL_CUSTOM
toolchain/toolchain-external/ext-tool.mk +3 -0
@@ -248,6 +248,9 @@ TOOLCHAIN_EXTERNAL_SOURCE=microblazeel-unknown-linux-gnu.tgz else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_XILINX_MICROBLAZEBE_V2),y) TOOLCHAIN_EXTERNAL_SITE=http://git.xilinx.com/?p=xldk/microblaze_v2.0.git;a=blob;h=71e031ae990e063a5718f90d30cf97ad85e2f565;hb=569081301f0f1d8d3b24335a364e8ff1774190d4;f= TOOLCHAIN_EXTERNAL_SOURCE=microblaze-unknown-linux-gnu.tgz +else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_SOURCERY_CODEBENCH_FREESCALE_COLDFIRE_201109),y) +TOOLCHAIN_EXTERNAL_SITE=??? +TOOLCHAIN_EXTERNAL_SOURCE=freescale-coldfire-2011.09-23-m68k-uclinux-i686-pc-linux-gnu.tar.bz2 else # A value must be set (even if unused), otherwise the # $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE) rule would override the main
Signature · 1 line
1.7.4.1
PATCH 3/5 toolchain: add m68k to the list of arch that can work without MMU
In reply to Thomas PetazzoniThe early m68k had no MMU, later m68k had MMUs, but Coldfires don't have MMU.
--- toolchain/toolchain-common.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
toolchain/toolchain-common.in +1 -1
@@ -75,7 +75,7 @@ config BR2_NEEDS_GETTEXT_IF_LOCALE default y if (BR2_NEEDS_GETTEXT && BR2_ENABLE_LOCALE) config BR2_USE_MMU - bool "Enable MMU support" if BR2_arm || BR2_armeb || BR2_mips || BR2_mipsel || BR2_sh || BR2_xtensa + bool "Enable MMU support" if BR2_arm || BR2_armeb || BR2_mips || BR2_mipsel || BR2_sh || BR2_xtensa || BR2_m68k default y if !BR2_bfin help If your target has a MMU, you should say Y here. If you
Signature · 1 line
1.7.4.1
PATCH 4/5 busybox: enable useful hush suboptions
In reply to Thomas PetazzoniOur default Busybox configuration enables the ash shell, but since this shell doesn't work on noMMU platforms, we enable the hush shell instead. However, the hush shell by itself isn't very useful without interactive mode, support for loops, if and case statements, etc. So we enable them.
The drawback of this method is that those options are forcefully selected, regarless of the users choices. The other solution would be to have a separate Busybox configuration for noMMU platforms, or work with fragments of Busybox configurations.
--- package/busybox/busybox.mk | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
package/busybox/busybox.mk +5 -0
@@ -131,6 +131,11 @@ define BUSYBOX_DISABLE_MMU_APPLETS $(call KCONFIG_DISABLE_OPT,CONFIG_SWAPONOFF,$(BUSYBOX_BUILD_CONFIG)) $(call KCONFIG_DISABLE_OPT,CONFIG_ASH,$(BUSYBOX_BUILD_CONFIG)) $(call KCONFIG_ENABLE_OPT,CONFIG_HUSH,$(BUSYBOX_BUILD_CONFIG)) + $(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_IF,$(BUSYBOX_BUILD_CONFIG)) + $(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_LOOPS,$(BUSYBOX_BUILD_CONFIG)) + $(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_CASE,$(BUSYBOX_BUILD_CONFIG)) + $(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_FUNCTIONS,$(BUSYBOX_BUILD_CONFIG)) + $(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_INTERACTIVE,$(BUSYBOX_BUILD_CONFIG)) endef endif
Signature · 1 line
1.7.4.1
PATCH 5/5 board: add support for Coldfire MCF5208EVB board emulated by Qemu
In reply to Thomas PetazzoniThe support requires a slightly patched Qemu, and doesn't work nicely
yet: the kernel crashes when the first userspace programs exits.
--- .../qemu/m68k-mcf5208evb/linux-3.3-sw-ustack.patch | 25 +++++++ board/qemu/m68k-mcf5208evb/linux-3.3.config | 71 ++++++++++++++++++++ .../qemu-mcfint-masking-support.patch | 42 ++++++++++++ board/qemu/m68k-mcf5208evb/readme.txt | 14 ++++ configs/qemu_m68k_mcf5208_evb_defconfig | 14 ++++ 5 files changed, 166 insertions(+), 0 deletions(-) create mode 100644 board/qemu/m68k-mcf5208evb/linux-3.3-sw-ustack.patch create mode 100644 board/qemu/m68k-mcf5208evb/linux-3.3.config create mode 100644 board/qemu/m68k-mcf5208evb/qemu-mcfint-masking-support.patch create mode 100644 board/qemu/m68k-mcf5208evb/readme.txt create mode 100644 configs/qemu_m68k_mcf5208_evb_defconfig
board/qemu/m68k-mcf5208evb/linux-3.3-sw-ustack.patch new file +25 -0
@@ -0,0 +1,25 @@ +m68k: enabled software emulation of separate supervisor/user stack + +Recent Coldfires have separate supervisor and user stack pointers, but +since older Coldfires didn't have that, the Linux kernel has a kind of +emulation mechanism for those pointers. + +Apparently, according to the Kconfig.cpu file, the 5208 is supposed to +support such separate pointers, but Qemu doesn't implement it. So we +cheat a bit here and force the usage of emulated separate stack +pointers. + +Signed-off-by: Thomas Petazzoni <[email protected]> + +diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu +index 8a9c767..b9ff29a 100644 +--- a/arch/m68k/Kconfig.cpu ++++ b/arch/m68k/Kconfig.cpu +@@ -146,6 +146,7 @@ config M520x + depends on !MMU + select GENERIC_CLOCKEVENTS + select HAVE_CACHE_SPLIT ++ select COLDFIRE_SW_A7 + help + Freescale Coldfire 5207/5208 processor support. +
board/qemu/m68k-mcf5208evb/linux-3.3.config new file +71 -0
71 lines not on this page · raw message
board/qemu/m68k-mcf5208evb/qemu-mcfint-masking-support.patch new file +42 -0
42 lines not on this page · raw message
board/qemu/m68k-mcf5208evb/readme.txt new file +14 -0
@@ -0,0 +1,14 @@ +Compile a Qemu with the +board/qemu/m68k-mcf5208evb/qemu-mcfint-masking-support.patch patch +applied, which fixes problems in the interrupt controller emulation. + +To start the emulation, run: + + qemu-system-m68k -M mcf5208evb -kernel output/images/vmlinux -serial stdio + +The filesystem is included as an initramfs inside the kernel image. + +At the moment, the boot process hangs when the first userspace process +exits, with the kernel believing that someone is attempting to kill +init. +
configs/qemu_m68k_mcf5208_evb_defconfig new file +14 -0
@@ -0,0 +1,14 @@ +BR2_m68k=y +BR2_m68k_5208=y +BR2_TOOLCHAIN_EXTERNAL=y +BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY=y +# BR2_USE_MMU is not set +BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y +# BR2_TARGET_ROOTFS_TAR is not set +BR2_TARGET_ROOTFS_INITRAMFS=y +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="3.3" +BR2_LINUX_KERNEL_PATCH="board/qemu/m68k-mcf5208evb/" +BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/m68k-mcf5208evb/linux-3.3.config"
Signature · 1 line
1.7.4.1
PATCH 3/5 toolchain: add m68k to the list of arch that can work without MMU
In reply to Thomas Petazzonitoolchain/toolchain-common.in config BR2_NEEDS_GETTEXT_IF_LOCALE · line 81
Quoted 11 lines · Thomas Petazzoni
The early m68k had no MMU, later m68k had MMUs, but Coldfires don't have MMU.
config
BR2_USE_MMU(quoted diff) +0
-1- bool "Enable MMU support" if BR2_arm || BR2_armeb || BR2_mips ||
BR2_mipsel||BR2_sh||BR2_xtensa(quoted diff) +1
-0+ bool "Enable MMU support" if BR2_arm || BR2_armeb || BR2_mips ||
BR2_mipsel||BR2_sh||BR2_xtensa||BR2_m68ktoolchain/toolchain-common.in +0
-0default y if !BR2_bfin help If your target has a MMU, you should say Y here. If you
Maybe default y if !(BR2_bfin || BR2_m68k) ? Since most people will target Coldfire rather than 68xxx. A quick look says v4 and v5 have MMU though. Regards.
PATCH 2/5 toolchain: add Coldfire external toolchain from Sourcery CodeBench
In reply to Thomas PetazzoniQuoted 1 line · On Tuesday 10 April 2012 18:10:46 Thomas Petazzoni wrote:
+TOOLCHAIN_EXTERNAL_SITE=???
Shouldn't that be
http://sourcery.mentor.com/sgpp/lite/coldfire/portal/package9494/public/m68k-uclinux/
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286540 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
PATCH 2/5 toolchain: add Coldfire external toolchain from Sourcery CodeBench
Le Wed, 18 Apr 2012 00:54:35 +0200,
Arnout Vandecappelle <[email protected]> a ?crit :
Quoted 5 lines · On Tuesday 10 April 2012 18:10:46 Thomas Petazzoni wrote:
Quoted 1 line
+TOOLCHAIN_EXTERNAL_SITE=???
Shouldn't that be
http://sourcery.mentor.com/sgpp/lite/coldfire/portal/package9494/public/m68k-uclinux/
Yes, sorry. I implemented this during a week-end, and I had no Internet connection at that time :)
I'll fix up and resend.
Best regards,
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com