Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为完成gcc12编译pmon, 进行的一些修改 #11

Closed
wants to merge 14 commits into from

Conversation

lshw
Copy link

@lshw lshw commented Dec 22, 2023

close #10
在debian系统里, 安装原生的gcc12的交叉编译工具,进行编译, 目前可以完成编译的板子型号:
3a2h 3a3000_7a 3a4000_7a 3a82h 3a92h 3avirt lm-a1901 ls2k-edu ls2k-pi2 ls2k

pmon/arch/mips/mips.S:390: Error: float register should be even, was 1
mipsel-linux-gnu-gcc -mabi=32   -mno-abicalls -fno-pic -I/usr/src/pmon/lib/libc/arch/mips -mips3 -mfp32 	-I. -I/usr/src/pmon/Targets/LS2K/compile/ls2k-pi2/../../../../include -I./machine -I/usr/src/pmon/Targets/LS2K/compile/ls2k-pi2/../../../.. -I/usr/src/pmon/Targets/LS2K/compile/ls2k-pi2/../../../../sys/arch/mips/include -I/usr/src/pmon/Targets/LS2K/compile/ls2k-pi2/../../../../sys -I/usr/src/pmon/Targets/LS2K/compile/ls2k-pi2/../../../../Targets/LS2K -I/usr/src/pmon/Targets/LS2K/compile/ls2k-pi2 -I -nostdinc -fno-strict-aliasing -fno-pic -I/usr/src/pmon/Targets/LS2K/compile/ls2k-pi2/../../../../x86emu/int10/x86emu/include -I/usr/src/pmon/Targets/LS2K/compile/ls2k-pi2/../../../../x86emu/int10/x86emu/src/x86emu/x86emu  -DLS2K_BOARD_PI2 -DBOARD_NAME="\"Loongson-2K-SOC-1w-V1-PI2\"" -DCONFIG_VIDEO_SPLASH -DCONFIG_VIDEO_LOGO_CUISI -DLOONGSON_2K -DBOOT_PARAM -DVRAM_SIZE="0x10" -DSYSTYPE="\"FCR\"" -DTARGETNAME="\"FCR\"" -DLS2K_STR -DBONITOEL -DDEVBD2E -DMIPS -DINET -DLS3_HT -Dloongson3A3 -DLSMC_2 -DDDR3_DIMM -DLOONGSON_GMAC -DDTB -DINTERFACE_3A780E -DCONS_BAUD="B115200" -DMY40IO -DMY61IO -DVGA_BASE="0xb0000000" -DVGA_NO_ROM -DNOPCINAMES -DFB_XSIZE="0x400" -DFB_YSIZE="0x300" -DCONFIG_VIDEO_16BPP -DNOSNOOP -DHAVE_TOD -DINTERNAL_RTC -DHAVE_NVENV -DHAVE_LOGO -DUSE_SUPERIO_UART -DAUTOLOAD -DCONFIG_CACHE_64K_4WAY -DNVRAM_IN_FLASH -DSET_DDR_FREQ -DIDE_DMA -DIDECD -DUSE_ENVMAC -DFOR_GXEMUL -DFLOATINGPT -DCOM3_BASE_ADDR="0xbfe001e0" -DINPUT_FROM_BOTH -DOUTPUT_TO_BOTH -DKBD_CHECK_FAST -DTEST_USB_HOST -DCONFIG_SLOW_PCI_FOR_BROKENDEV -DCONFIG_VIDEO_SW_CURSOR -DDDR_S1="0xc1a18404" -DDDR_PARAM_018="0x3030303016100000" -DNO_AUTO_TRFC -DDDR_RESET_REVERT -DBEEP_GPIO="0x27" -DGPIO_PINS="0xffffffff80f0000f" -DLS2K_RESET_GPIOS_MASK="0x1000000000" -DPCIE_LANE_FLIP="0xc00" -DDDR_FREQ="0x190" -DCORE_FREQ="0x3e8" -DLS2K_DEFAULT_OLDPMON   -DFB_COLOR_BITS=16  -D_KERNEL -D__OpenBSD__ -DPMON -D__PMON__ -mmemcpy -mno-abicalls -fno-builtin -U_KERNEL -Wall -Wstrict-prototypes -Wno-uninitialized -Wno-format -Wno-main -O2 -G 0 -c  sigsetops.c -o /usr/src/pmon/Targets/LS2K/compile/ls2k-pi2/lib/libc/sigsetops.o
sigsetops.c:63:1: error: redefinition of 'sigaddset'
   63 | sigaddset(sigset_t *set, int signo)
      | ^~~~~~~~~
In file included from sigsetops.c:40:
/usr/src/pmon/Targets/LS2K/compile/ls2k-pi2/../../../../include/signal.h:68:21: note: previous definition of 'sigaddset' with type 'int(sigset_t *, int)' {aka 'int(unsigned int *, int)'}
mipsel-linux-gnu-ld: cd.o:(.bss+0x68): multiple definition of `CpuPrimaryDataCacheSize'; param.o:(.bss+0x294): first defined here
mipsel-linux-gnu-ld: cd.o:(.bss+0x6c): multiple definition of `CpuPrimaryInstSetSize'; param.o:(.bss+0x298): first defined here
mipsel-linux-gnu-ld: cd.o:(.bss+0x70): multiple definition of `CpuPrimaryInstCacheLSize'; param.o:(.bss+0x29c): first defined here
mipsel-linux-gnu-ld: cd.o:(.bss+0x74): multiple definition of `CpuPrimaryInstCacheSize'; param.o:(.bss+0x2a0): first defined here
mipsel-linux-gnu-ld: cd.o:(.bss+0x78): multiple definition of `CpuProcessorId'; param.o:(.bss+0x2a4): first defined here
mipsel-linux-gnu-ld: cd.o:(.bss+0x7c): multiple definition of `want_resched'; param.o:(.bss+0x2a8): first defined here
mipsel-linux-gnu-ld: cd.o:(.bss+0x80): multiple definition of `imask'; param.o:(.bss+0x2ac): first defined here
mipsel-linux-gnu-ld: cd.o:(.bss+0x9c): multiple definition of `astpending'; param.o:(.bss+0x2c8): first defined here
mipsel-linux-gnu-ld: cd.o:(.bss+0xa0): multiple definition of `ipending'; param.o:(.bss+0x2cc): first defined here
mipsel-linux-gnu-ld: cd.o:(.bss+0xa4): multiple definition of `cpl'; param.o:(.bss+0x2d0): first defined here
mipsel-linux-gnu-ld: usb_storage.o: in function `usb_stor_BBB_reset':
usb_storage.c:(.text+0x128): undefined reference to `wait_ms'
mipsel-linux-gnu-ld: usb_storage.c:(.text+0x16c): undefined reference to `wait_ms'
mipsel-linux-gnu-ld: usb_storage.c:(.text+0x1a8): undefined reference to `wait_ms'
mipsel-linux-gnu-ld: usb_storage.o: in function `usb_stor_CB_reset':
usb_storage.c:(.text+0x24c): undefined reference to `wait_ms'
mipsel-linux-gnu-ld: usb_storage.o: in function `usb_test_unit_ready':
usb_storage.c:(.text+0x380): undefined reference to `wait_ms'
mipsel-linux-gnu-ld: usb_storage.o:usb_storage.c:(.text+0xdc0): more undefined references to `wait_ms' follow
mipsel-linux-gnu-ld: pci_machdep.o: in function `_pci_hwinit':
pci_machdep.c:(.text+0x2e0): undefined reference to `read_c0_count'
mipsel-linux-gnu-ld: pci_machdep.c:(.text+0x34c): undefined reference to `read_c0_count'
mipsel-linux-gnu-ld: pci_machdep.c:(.text+0x3c0): undefined reference to `read_c0_count'
make[1]: *** [Makefile:177: pmon] Error 1
    initmips.c:109:7: warning: listing the stack pointer register '$29' in a clobber list is deprecated [-Wdeprecated]
@FlyGoat
Copy link
Member

FlyGoat commented Dec 22, 2023

PMON似乎应该是softfloat的?
为什么要-mfp32?
另外不告诉GCC clobber似乎有点危险....

以下板子可以成功编译:
3a780e
3a82w
3a84w
3a8780e
3a92w
3a9780e
3b780e
3afirewall

错误信息:
mipsel-linux-gnu-ld: tgt_machdep.o: in function init_win_device'
make[1]: *** [Makefile:158: pmon] Error 1
错误信息:
mipsel-linux-gnu-ld: termio.o: in function `tty_flush':
termio.c:(.text+0xfd0): undefined reference to `scancode_queue_init'
make[1]: *** [Makefile:145: pmon] Error 1
错误信息:
mipsel-linux-gnu-ld: start.o: in function `set_tREFI':
(.text+0x6a38): undefined reference to `DDR_FREQ'
mipsel-linux-gnu-ld: start.o: in function `x8':
(.text+0x6bb8): undefined reference to `DDR_FREQ'
make[1]: *** [Makefile:148: pmon] Error 1
�[200~In file included from /usr/src/pmon/Targets/Bonito2F7inch/compile/Bonito/../../../../pmon/dev/kbd.c:293:
/usr/src/pmon/Targets/Bonito2F7inch/compile/Bonito/../../../../include/kb3310.h: In function 'wrec':
/usr/src/pmon/Targets/Bonito2F7inch/compile/Bonito/../../../../include/kb3310.h:88:39: error: 'BONITO_PCIIO_BASE_VA' undeclared (first use in this function)
   88 |         *( (volatile unsigned char *)(BONITO_PCIIO_BASE_VA | HIGH_PORT) ) = (reg & 0xff00) >> 8;
      |                                       ^~~~~~~~~~~~~~~~~~~~
/usr/src/pmon/Targets/Bonito2F7inch/compile/Bonito/../../../../include/kb3310.h:88:39: note: each undeclared identifier is reported only once for each function it appears in
/usr/src/pmon/Targets/Bonito2F7inch/compile/Bonito/../../../../include/kb3310.h: In function 'rdec':
/usr/src/pmon/Targets/Bonito2F7inch/compile/Bonito/../../../../include/kb3310.h:95:39: error: 'BONITO_PCIIO_BASE_VA' undeclared (first use in this function)
   95 |         *( (volatile unsigned char *)(BONITO_PCIIO_BASE_VA | HIGH_PORT) ) = (reg & 0xff00) >> 8;
      |                                       ^~~~~~~~~~~~~~~~~~~~
错误信息:
mipsel-linux-gnu-ld: main.o: in function `main':
main.c:(.text.startup+0x0): undefined reference to `cmd_main_mutex'
mipsel-linux-gnu-ld: main.c:(.text.startup+0x4): undefined reference to `cmd_main_mutex'
mipsel-linux-gnu-ld: main.c:(.text.startup+0x12c): undefined reference to `cmd_main_mutex'
mipsel-linux-gnu-ld: main.c:(.text.startup+0xb4): undefined reference to `cmd_main_mutex'
mipsel-linux-gnu-ld: main.c:(.text.startup+0x148): undefined reference to `cmd_main_mutex'
mipsel-linux-gnu-ld: main.c:(.text.startup+0x1ac): undefined reference to `bios_available'
mipsel-linux-gnu-ld: main.c:(.text.startup+0x1a4): undefined reference to `bios_available'
mipsel-linux-gnu-ld: main.c:(.text.startup+0x1c0): undefined reference to `bios_available'
mipsel-linux-gnu-ld: dev_part.o: in function `DevicesInit':
dev_part.c:(.text+0xb34): undefined reference to `is_ide_cd_ready'
make[1]: *** [Makefile:110: pmon] Error 1
修复主板型号:
2f7inch
2fdev.cs5536
2fdev.firewall
2fdev.sm502

错误信息:
mipsel-linux-gnu-ld: dev_part.o: in function `DevicesInit':
dev_part.c:(.text+0xb34): undefined reference to `is_ide_cd_ready'
make[1]: *** [Makefile:110: pmon] Error 1
修复:
2fdev

错误信息:
/usr/src/pmon/Targets/Bonito2fdev/compile/Bonito/../../../../Targets/Bonito2fdev/Bonito/tgt_machdep.c:347:12: error: conflicting types for 'memorysize'; have 'int'
  347 | extern int memorysize;
      |            ^~~~~~~~~~
In file included from /usr/src/pmon/Targets/Bonito2fdev/compile/Bonito/../../../../Targets/Bonito2fdev/pci/pci_machdep.h:36,
                 from /usr/src/pmon/Targets/Bonito2fdev/compile/Bonito/../../../../sys/dev/pci/pcivar.h:57,
                 from /usr/src/pmon/Targets/Bonito2fdev/compile/Bonito/../../../../Targets/Bonito2fdev/Bonito/tgt_machdep.c:62:
/usr/src/pmon/Targets/Bonito2fdev/compile/Bonito/../../../../include/pmon.h:211:32: note: previous declaration of 'memorysize' with type 'long long unsigned int'
  211 | extern unsigned long long      memorysize;
      |                                ^~~~~~~~~~
@lshw
Copy link
Author

lshw commented Dec 23, 2023

fp32是在用gcc12编译 1C的pmon时, 因为里面用到了一些浮点寄存器,报错了,而1C是带硬浮点的,这一块我去测试一下,
那个clobber, 是要初始化堆栈寄存器, 这在gcc12会有个警告信息, 初始化堆栈, 肯定是要修改堆栈指针的, 这里不改也行, 不会影响编译进行。

@lshw
Copy link
Author

lshw commented Dec 23, 2023

你的担心是正确的。我测了以下,虽然能够编译, 但是会有问题, 我先撤回了。

@lshw lshw closed this Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

使用gcc12编译pmon
2 participants