Hi Keith,
On 02.04.23 15:33, Keith Hui wrote:
Here is the command line I figured would work, gathered with "make -n":
gcc -Isrc -Isrc/include -Isrc/commonlib/include -Isrc/commonlib/bsd/include -Ibuild -I3rdparty/vboot/firmware/include -include src/include/kconfig.h -include src/include/rules.h -include src/commonlib/bsd/include/commonlib/bsd/compiler.h -I3rdparty -D__BUILD_DIR__="build" -Isrc/arch/x86/include -D__ARCH_x86_32__ -Isrc/device/oprom/include -nostdinc -pipe -g -std=gnu11 -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wno-trigraphs -Wimplicit-fallthrough -Wshadow -Wdate-time -Wtype-limits -Wvla -Wold-style-definition -Wdangling-else -Wmissing-include-dirs -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer -fstrict-aliasing -ffunction-sections -fdata-sections -fno-pie -Wno-packed-not-aligned -fconserve-stack -Wnull-dereference -Wreturn-type -Wlogical-op -Wduplicated-cond -Wno-unused-but-set-variable -Werror -Os -Wno-address-of-packed-member -m32 -fuse-ld=bfd -fno-stack-protector -Wl,--build-id=none -fno-delete-null-pointer-checks -Wlogical-op -march=i686 -mno-mmx --param asan-globals=0 -D__RAMSTAGE__ -include build/config.h src/northbridge/intel/i440bx/raminit.c src/northbridge/intel/i440bx/raminittest.c -o raminittest2023
The C test code is attached.
I'm seeing two errors, smbus_read_byte() not being declared and <unistd.h> missing.
For the former, you should build with -D__ROMSTAGE__ (not R*A*MSTAGE).
For the latter, I guess it might be better to compile `raminit.c` with the coreboot include paths and your `raminittest.c` with your host headers, i.e. *without* `-nostdinc` and coreboot paths. If that actually works depends a lot on details; it would be best to compile everything with the host's standard headers and only use those coreboot headers that are coreboot specific. However, both kinds of headers are mixed in coreboot's directory structure and some headers in coreboot that have standard names are actually not standard :-/
With separate compilation, I get to
fatal error: standalonetest.h: No such file or directory
;)
Cheers, Nico