Porting to an AM186 demo board, need some help

TrafoKopf <[email protected]> Sun, 17 Oct 2021 00:36:11 +0200
Newsgroups gmane.linux.ports.x8086
Message-ID <[email protected]>
Hi,

I have a AMD demo board with a AM186ES 40MHz chip, 256k flash and 256k
RAM. This chip is slightly different from others like the 8018x one in ELK=
S.

I've started to write code for this chip, but I am struggling with
menuconfig and Makefiles. My files are not even get compiled (verified
by adding "#error bla" to files, no error thrown).

My steps so far:

1) I started by creating a (huge) MSR definition file directly from
datasheet, this one should be 100% done, hopefully nothing missed :)

I copied files from recent 8018x changes to -am186.c and rewrote
routines/pieces for my MCU, added to makefiles etc:

2) elks/config.in

...

 =C2=A0=C2=A0=C2=A0 choice 'Select system' \
 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 "IBM-PC CONFIG_ARCH_IBMPC \
 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0AM186=C2=A0 CONFIG_ARCH_AM186=
 \
 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A08018X=C2=A0=C2=A0=C2=A0 CONFI=
G_ARCH_8018X" IBM-PC

...

 =C2=A0=C2=A0=C2=A0 elif [ "$CONFIG_ARCH_8018X" =3D "y" ]; then

 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 comment 'Platform'

 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 comment 'Devices'
 =C2=A0=C2=A0=C2=A0 elif [ "$CONFIG_ARCH_AM186" =3D "y" ]; then
 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 comment 'Platform'
 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 comment 'Devices'
 =C2=A0=C2=A0=C2=A0 fi

...

 =C2=A0=C2=A0=C2=A0 if [ "$CONFIG_ARCH_AM186" =3D "y" ]; then
 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 bool 'Build kernel as ROM-bootable'=
 CONFIG_ROMCODE=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 n
 =C2=A0=C2=A0=C2=A0 fi

...

3) created arch/i86/drivers/char/conio-am186.c

4) changed arch/i86/drivers/char/Makefile

...

ifeq ($(CONFIG_ARCH_AM186), y)
 =C2=A0=C2=A0=C2=A0 CONIO =3D am186
 =C2=A0=C2=A0=C2=A0 SERIAL =3D template
endif
....

5) created arch/i86/kernel/irq-am186.c

6) changed arch/i86/kernel/irqtab.S

7) created arch/i86/kernel/timer-am186.c

8) changed arch/i86/kernel/Makefile

...

ifeq ($(CONFIG_ARCH_AM186), y)
OBJS +=3D irq-am186.o timer-am186.o
endif

...

9) changed include/linuxmt/config.h

#ifdef CONFIG_ARCH_AM186
#define MAX_SERIAL=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 2=C2=A0=C2=A0=C2=
=A0 /* max number of serial tty devices*/

#define SETUP_VID_COLS=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 80=C2=A0=C2=A0=
=C2=A0 /* BIOS video # columns */
#define SETUP_VID_LINES=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 25=C2=A0=C2=
=A0=C2=A0 /* BIOS video # lines */
#define SETUP_CPU_TYPE=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 5=C2=A0=C2=A0=
=C2=A0 /* processor type 80186 */
#define SETUP_MEM_KBYTES=C2=A0=C2=A0=C2=A0 256=C2=A0=C2=A0=C2=A0 /* base m=
emory in 1K bytes */
#define SETUP_ROOT_DEV=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x0600=C2=A0=
=C2=A0=C2=A0 /* root device ROMFS */
#define SETUP_ELKS_FLAGS=C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2=A0 /* flags fo=
r root device type */
#define SETUP_PART_OFFSETLO=C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2=A0 /* parti=
tion offset low word */
#define SETUP_PART_OFFSETHI=C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2=A0 /* parti=
tion offset high word */
#define SYS_CAPS=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2=A0 =
/* no XT/AT capabilities */

#define SETUP_HEAPSIZE=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 1024=C2=A0=C2=
=A0=C2=A0 /* minimum kernel heap for now*/

#define CONFIG_AM186_FCPU=C2=A0=C2=A0=C2=A0 40
#endif

10) created a .config with these settings:

CONFIG_ARCH_AM186=3Dy
CONFIG_SMALL_KERNEL=3Dy
CONFIG_ROMCODE=3Dy
CONFIG_EXPERIMENTAL=3Dy
CONFIG_ROM_SETUP_CODE=3D0xe000
CONFIG_ROM_KERNEL_CODE=3D0xe060
CONFIG_ROM_SETUP_DATA=3D0x0060
CONFIG_ROM_KERNEL_DATA=3D0x0080
CONFIG_ROM_BASE=3D0xe000
CONFIG_ROM_CHECKSUM_SIZE=3D64
CONFIG_ROM_BOOTABLE_BY_RESET=3Dy
CONFIG_ROM_RESET_ADDRESS=3D0x0003
CONFIG_ROMFS_FS=3Dy
CONFIG_ROMFS_BASE=3D0x8000
CONFIG_FULL_VFS=3Dy
CONFIG_PIPE=3Dy
CONFIG_CONSOLE_HEADLESS=3Dy
CONFIG_KEYBOARD_SCANCODE=3Dy
CONFIG_CONSOLE_SERIAL=3Dy
CONFIG_CHAR_DEV_RS=3Dy
CONFIG_APP_SASH=3Dy
CONFIG_IMG_ROM=3Dy

After all that I go to root folder of source, where I have run build.sh
the first time.

I do this:

$ source env.sh

$ make clean

$ make

It runs for quite a few minutes (old machine) and stops with this:

...

...

gcc -I/home/bx/elks-dev/elks-am186/include
-I/home/bx/elks-dev/elks-am186/elks/include -o build build.c
gcc -I/home/bx/elks-dev/elks-am186/include
-I/home/bx/elks-dev/elks-am186/elks/include -o mkbootloader mkbootloader.c
make[3]: Verzeichnis =E2=80=9E/home/bx/elks-dev/elks-am186/elks/arch/i86/t=
ools=E2=80=9C
wird verlassen
gcc -E -traditional -I/home/bx/elks-dev/elks-am186/include
-I/home/bx/elks-dev/elks-am186/elks/include
-I/home/bx/elks-dev/elks-am186/libc/include -DUTS_RELEASE=3D\"0.4.0\"
-D__KERNEL__ -o boot/setup.tmp boot/setup.S
ia16-elf-as=C2=A0=C2=A0 --32-segelf -o boot/setup.o boot/setup.tmp
rm boot/setup.tmp
ia16-elf-ld.gold=C2=A0 -s=C2=A0 -M -T
/home/bx/elks-dev/elks-am186/elks/elks-tiny.ld -o boot/setup
boot/setup.o > boot/setup.map
boot/setup.o(.text+0x2e): error: undefined reference to 'arch_set_initseg'
boot/setup.o(.text+0xfe): error: undefined reference to 'putc'
boot/setup.o(.text+0x112): error: undefined reference to 'putc'
boot/setup.o(.text+0x140): error: undefined reference to 'putc'
make[2]: *** [Makefile:98: boot/setup] Fehler 1
make[2]: Verzeichnis =E2=80=9E/home/bx/elks-dev/elks-am186/elks/arch/i86=
=E2=80=9C wird
verlassen
make[1]: *** [Makefile:75: Image] Fehler 2
make[1]: Verzeichnis =E2=80=9E/home/bx/elks-dev/elks-am186/elks=E2=80=9C w=
ird verlassen
make: *** [Makefile:13: all] Fehler 2


What am I missing / did I do wrong?


Thank you,

Nils