-
Notifications
You must be signed in to change notification settings - Fork 5
Build H2 with Picolibc #10
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 (0 == (pmap->base.raw = (h2_u32_t)realloc((void *)(pmap->base.raw), sizeof(H2K_linear_fmt_t) * (end + npages + 1)))) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why 0?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in Pico toolchain NULL in preprocessed to ((void*)0) (comes from clang's stddef.h)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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
|
||
| error("realloc pmap->base", NULL); | ||
| } | ||
| base = (H2K_linear_fmt_t *)(pmap->base.raw); | ||
|
|
@@ -763,7 +763,7 @@ void clade_setup(unsigned int idx, long offset) { | |
| /* Copy high-prio exception data to TCM */ | ||
| ex_hi_size = ex_hi_end - ex_hi_start; | ||
| if (ex_hi_size && tcm_size) { | ||
| if (NULL == (vm_params[idx].clade_ex_hi = (unsigned int)h2_galloc(&tcm_alloc, ex_hi_size, 4096, 0))) { | ||
| if (0 == (vm_params[idx].clade_ex_hi = (unsigned int)h2_galloc(&tcm_alloc, ex_hi_size, 4096, 0))) { | ||
| FAIL("\tgalloc ex_hi", ""); | ||
| } | ||
| // BOOTER_PRINTF("memcpy(0x%08x, 0x%08lx, 0x%08lx\n", vm_params[idx].clade_ex_hi, ex_hi_start + offset, ex_hi_size); | ||
|
|
@@ -2309,6 +2309,7 @@ unsigned int process_line(int argc, char **argv, unsigned int idx) { | |
| return idx; | ||
| } | ||
|
|
||
| #ifndef __PICOLIBC__ | ||
| size_t getline(char **lineptr, size_t *n, FILE *stream) { | ||
|
|
||
| char *buf = NULL; | ||
|
|
@@ -2361,6 +2362,7 @@ size_t getline(char **lineptr, size_t *n, FILE *stream) { | |
|
|
||
| return p - buf - 1; | ||
| } | ||
| #endif /* !__PICOLIBC__ */ | ||
|
|
||
| int main(int argc, char **argv) | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about pulling all these if pico sections into one make include file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?