Build H2 with Picolibc#10
Conversation
colmode
left a comment
There was a problem hiding this comment.
Looks good overall, but we might want to merge this after erich's makefile changes rather than the other way around.
| r1 = #__boot_net_phys_offset__ | ||
| memw(r1) = r0 | ||
| jump _start // picolibc CRT entry (replaces hexagon_pre_main) | ||
|
|
There was a problem hiding this comment.
we can, but since we are not including any C header, we don't have __PICOLIBC__
so for simplicity I created 2 files
maybe I will have to use the PICOLIBC=1 flag to define a macro, which we can use
or do you have something else in mind?
There was a problem hiding this comment.
"PICOLIBC=1 flag to define a macro", yes. But since this is all transitional and we'll eventually use only pico I think that leaving it as is would be fine.
| r1 = #__boot_net_phys_offset__ | ||
| memw(r1) = r0 | ||
| jump _start // picolibc CRT entry (replaces hexagon_pre_main) | ||
|
|
There was a problem hiding this comment.
we can, but since we are not including any C header, we don't have __PICOLIBC__
so for simplicity I created 2 files
maybe I will have to use the PICOLIBC=1 flag to define a macro, which we can use
or do you have something else in mind?
thanks for the review, ping me whenever that is merged, I will have to resolve merge conflicts
sure, so far I have built H2 successfully and used the install artifacts to run Picolibc testsuite which passes |
Hey, look; our first comment from a non-qc account :) |
|
why is |
Because most of the unit tests run with standalone with a test harness for testing only one function -- avoids booting the kernel to simplify debug. We need a substitute for standalone but we haven't addressed this yet. The unit tests don't even use features of standalone. Using the default dinkum build is just a convenient way to link with crt0 and get to main(). We actually have a min_crt0 in the h2 repo. Just need to dust that off and change how we link unit tests. Here it is, entirely: /*
.global _start#_start: jump starthexagon_pre_main: jump startstack: |
yeah, for debugging that is better, but booter tests would have been easier for me to get passing
is this planned to be done soon? or am I supposed to do this in this PR? maybe I could but this sounds like lot of debugging |
Not unless you're really keen to do it. I just filed QDSP-57392 for this. |
bryanb-h2
left a comment
There was a problem hiding this comment.
The merge conflicts with master were complicated in some places. Please check if I screwed something up.
| } | ||
|
|
||
| if (NULL == (pmap->base.raw = (h2_u32_t)realloc((void *)(pmap->base.raw), sizeof(H2K_linear_fmt_t) * (end + npages + 1)))) { | ||
| if (0 == (pmap->base.raw = (h2_u32_t)realloc((void *)(pmap->base.raw), sizeof(H2K_linear_fmt_t) * (end + npages + 1)))) { |
There was a problem hiding this comment.
booter.c:673:11: warning: comparison between pointer and integer ('void *' and 'h2_u32_t' (aka 'unsigned int')) [-Wpointer-integer-compare]
673 | if (NULL == (pmap->base.raw = (h2_u32_t)realloc((void *)(pmap->base.raw), sizeof(H2K_linear_fmt_t) * (end + npages + 1)))) {
| ~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There was a problem hiding this comment.
So pico defines NULL differently? I thought that def was part of the tools and we don't get the same warning when building with the existing dinkum tools.
There was a problem hiding this comment.
in Pico toolchain NULL in preprocessed to ((void*)0) (comes from clang's stddef.h)
existing tools might be just defining NULL to 0
There was a problem hiding this comment.
Ok, then the right thing to do is probably this, which works with dinkum also:
diff --git a/booter/booter.c b/booter/booter.c
index 071702bc6..93fcf9adc 100644
--- a/booter/booter.c
+++ b/booter/booter.c
@@ -670,7 +670,7 @@ void add_linear_trans(unsigned int idx, unsigned long va, unsigned long long pa,
vm_params[idx].pmap_added = 1;
}
- if (NULL == (pmap->base.raw = (h2_u32_t)realloc((void *)(pmap->base.raw), sizeof(H2K_linear_fmt_t) * (end + npages + 1)))) {
- if (NULL == (void *)(pmap->base.raw = (h2_u32_t)realloc((void *)(pmap->base.raw), sizeof(H2K_linear_fmt_t) * (end + npages + 1)))) {
error("realloc pmap->base", NULL);
}
base = (H2K_linear_fmt_t *)(pmap->base.raw);
|
|
||
| CFLAGS = $(OPTIMIZE) -mv$(TOOLARCH) -DARCHV=$(ARCHV) -Wall -Werror -Wno-builtin-requires-header -g -I. -I$(INSTALLPATH)/include -I$(KERNEL_BUILD_DIR)/include | ||
| LDFLAGS = -L$(INSTALLPATH)/lib -moslib=h2 -Qunused-arguments | ||
| ifeq ($(PICOLIBC),1) |
There was a problem hiding this comment.
How about pulling all these if pico sections into one make include file?
There was a problem hiding this comment.
sure, I could do something like that
but maybe I should wait till H2 unit tests are cleaned up, so I don't have to rebase multiple times?
Replace all patsubst %/install,%/build/...,$(INSTALLPATH) expressions with $(INSTALLPATH)/../build/... across kernel, libs, booter, and stake Makefiles so that a user-supplied INSTALLPATH without a trailing /install no longer causes same-file cp errors, circular dependencies, or missing generated headers. Signed-off-by: Kushal Pal <kushpal@qti.qualcomm.com>
libs/locks and libs/syscall/wrapper were writing .o files and archives directly into the source tree. Add BUILD_DIR := $(INSTALLPATH)/../build/... to both Makefiles and update libs/Makefile to reference the archives from the build tree rather than the source tree. Signed-off-by: Kushal Pal <kushpal@qti.qualcomm.com>
Signed-off-by: Kushal Pal <kushpal@qti.qualcomm.com>
quic-k
left a comment
There was a problem hiding this comment.
I have rebased on master
| } | ||
|
|
||
| if (NULL == (pmap->base.raw = (h2_u32_t)realloc((void *)(pmap->base.raw), sizeof(H2K_linear_fmt_t) * (end + npages + 1)))) { | ||
| if (0 == (pmap->base.raw = (h2_u32_t)realloc((void *)(pmap->base.raw), sizeof(H2K_linear_fmt_t) * (end + npages + 1)))) { |
There was a problem hiding this comment.
booter.c:673:11: warning: comparison between pointer and integer ('void *' and 'h2_u32_t' (aka 'unsigned int')) [-Wpointer-integer-compare]
673 | if (NULL == (pmap->base.raw = (h2_u32_t)realloc((void *)(pmap->base.raw), sizeof(H2K_linear_fmt_t) * (end + npages + 1)))) {
| ~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||
| CFLAGS = $(OPTIMIZE) -mv$(TOOLARCH) -DARCHV=$(ARCHV) -Wall -Werror -Wno-builtin-requires-header -g -I. -I$(INSTALLPATH)/include -I$(KERNEL_BUILD_DIR)/include | ||
| LDFLAGS = -L$(INSTALLPATH)/lib -moslib=h2 -Qunused-arguments | ||
| ifeq ($(PICOLIBC),1) |
There was a problem hiding this comment.
sure, I could do something like that
but maybe I should wait till H2 unit tests are cleaned up, so I don't have to rebase multiple times?
No description provided.