diff options
| -rw-r--r-- | meta/classes-recipe/baremetal-image.bbclass | 2 | ||||
| -rw-r--r-- | meta/recipes-core/newlib/newlib.inc | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/meta/classes-recipe/baremetal-image.bbclass b/meta/classes-recipe/baremetal-image.bbclass index b9a584351a..4e7d413626 100644 --- a/meta/classes-recipe/baremetal-image.bbclass +++ b/meta/classes-recipe/baremetal-image.bbclass | |||
| @@ -103,7 +103,7 @@ QB_OPT_APPEND:append:qemuriscv32 = " -bios none" | |||
| 103 | # since medlow can only access addresses below 0x80000000 and RAM | 103 | # since medlow can only access addresses below 0x80000000 and RAM |
| 104 | # starts at 0x80000000 on RISC-V 64 | 104 | # starts at 0x80000000 on RISC-V 64 |
| 105 | # Keep RISC-V 32 using -mcmodel=medlow (symbols lie between -2GB:2GB) | 105 | # Keep RISC-V 32 using -mcmodel=medlow (symbols lie between -2GB:2GB) |
| 106 | CFLAGS:append:qemuriscv64 = " -mcmodel=medany" | 106 | TARGET_CFLAGS:append:qemuriscv64 = " -mcmodel=medany" |
| 107 | 107 | ||
| 108 | 108 | ||
| 109 | ## Emulate image.bbclass | 109 | ## Emulate image.bbclass |
diff --git a/meta/recipes-core/newlib/newlib.inc b/meta/recipes-core/newlib/newlib.inc index 6113f5e831..34b0f3f747 100644 --- a/meta/recipes-core/newlib/newlib.inc +++ b/meta/recipes-core/newlib/newlib.inc | |||
| @@ -28,6 +28,14 @@ B = "${WORKDIR}/build" | |||
| 28 | ## disable stdlib | 28 | ## disable stdlib |
| 29 | TARGET_CC_ARCH:append = " -nostdlib" | 29 | TARGET_CC_ARCH:append = " -nostdlib" |
| 30 | 30 | ||
| 31 | # Both the C library and the application should share the same mcmodel. | ||
| 32 | # Use the medium-any code model for the RISC-V 64 bit implementation, | ||
| 33 | # since medlow can only access addresses below 0x80000000 and RAM | ||
| 34 | # starts at 0x80000000 on RISC-V 64 | ||
| 35 | # Keep RISC-V 32 using -mcmodel=medlow (symbols lie between -2GB:2GB) | ||
| 36 | TARGET_CFLAGS:append:qemuriscv64 = " -mcmodel=medany" | ||
| 37 | |||
| 38 | |||
| 31 | EXTRA_OECONF = " \ | 39 | EXTRA_OECONF = " \ |
| 32 | --build=${BUILD_SYS} \ | 40 | --build=${BUILD_SYS} \ |
| 33 | --target=${TARGET_SYS} \ | 41 | --target=${TARGET_SYS} \ |
