# Some Freedom Studio QEMU annoyances

**URL:** <https://forums.sifive.com/t/some-freedom-studio-qemu-annoyances/5561>\
**Category:** HiFive Unmatched\
**Created:** [January 16, 2022, 12:01am UTC](https://forums.sifive.com/t/some-freedom-studio-qemu-annoyances/5561 "2022-01-16T00:01:12Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![abirtz](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@abirtz](https://forums.sifive.com/u/abirtz)\
**Post date:** [January 16, 2022, 12:01am UTC](https://forums.sifive.com/t/some-freedom-studio-qemu-annoyances/5561/1 "2022-01-16T00:01:12Z")

</div>

1-

After add .s to Preferences → C/C++ → Files Types as Assembly Source file  
rename a .S file with .s extension make C “extern” function declaration lost link .globl symbol.  
The same code (with .s extension) work perfectly with gcc on Unmatched board.

Any way to make Freedom Studio QEMU work with .s file as it work with .S file ?

2-

printf(“123\n456\n789”); output only “123”

3-

“step” (F6) in C file ignore faraway breakpoint in .S file when there are many breakpoint. Only “step in” (F5) allow to go into .S file.  
Same behavior happen when steping jal in .S file. And sometime with branch/jump instruction.

4-

Gap between instruction arrow pointer and PC in .S file editor window.  
The disassembly window instruction arrow pointer is set correctly to the PC but adding source (“Show Source”) to the disassembly show the same gap.  
There is no “Link with Active Debug Context” icon in file editor window.  
How to synchronise source listing arrow with PC ?

---

<div class="post-metadata">

**Author:** ![tgm](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@tgm](https://forums.sifive.com/u/tgm)\
**Post date:** [January 22, 2022, 11:36pm UTC](https://forums.sifive.com/t/some-freedom-studio-qemu-annoyances/5561/2 "2022-01-22T23:36:02Z")

</div>

> Any way to make Freedom Studio QEMU work with .s file as it work with .S file ?

No. It’s an eclipse (or maybe CDT) issue.  
Nothing to do with QEMU.  
See here:

> **[Assembly Files in Eclipse CDT Projects](https://mcuoneclipse.com/2016/05/05/assembly-files-in-eclipse-cdt-projects/)**
>
> My embedded applications are implemented mostly in C, a few in C/C++. But all of them have one or few assembly files included too: Assembly programming is the needed to do low-level things so it is…

> printf(“123\n456\n789”); output only “123”

Does doing fflush(stdout); after the printf make any difference?

I don’t really understand #3 and #4.

---

<div class="post-metadata">

**Author:** ![abirtz](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@abirtz](https://forums.sifive.com/u/abirtz)\
**Post date:** [January 24, 2022, 3:03pm UTC](https://forums.sifive.com/t/some-freedom-studio-qemu-annoyances/5561/3 "2022-01-24T15:03:41Z")

</div>

> [@tgm](#):
>
> Does doing fflush(stdout); after the printf make any difference?

Even with fflush(stdout); the output is only “123”  
Also try:  
setbuf(stdout, NULL);  
setlinebuf(stdout);  
after each printf does nothing.  
without success

> [@tgm](#):
>
> I don’t really understand #3 and #4.

The breakpoint point was set at line 1643 in tools.S file (editor window) in screen\_shot\_1  
but in fact break is done at line 1681 as shown in “Disassembly” window.  
There is a gap of 25 instructions between the PC arrow (blue, before line number) in tools.S file editor window and the PC arrow (blue, before instruction address in “Disassembly” window)

In screen\_shot\_2 the “Show Source” button add the .S source in “Disassembly” window.  
The .S source and disassembly instruction are completely desynchronized.

Note: this happen with large .S file. For small .S file everything work well.

 ![screen_shot_1](https://us1.discourse-cdn.com/flex020/uploads/sifive/original/2X/0/04bc97a32f5386434e5b1de5c2b6b370ac2852e8.png)

 ![screen_shot_2](https://us1.discourse-cdn.com/flex020/uploads/sifive/original/2X/6/6846e77667c5ed0d4526023b2f315f080705726c.png)

---

<div class="post-metadata">

**Author:** ![tgm](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@tgm](https://forums.sifive.com/u/tgm)\
**Post date:** [January 24, 2022, 6:18pm UTC](https://forums.sifive.com/t/some-freedom-studio-qemu-annoyances/5561/4 "2022-01-24T18:18:26Z")

</div>

What happens if you do this?

`printf("123\r\n456\r\n789\r\n");`

With regard to the breakpoint and assembly issue have you enabled instruction stepping mode?

---

<div class="post-metadata">

**Author:** ![abirtz](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@abirtz](https://forums.sifive.com/u/abirtz)\
**Post date:** [January 24, 2022, 8:53pm UTC](https://forums.sifive.com/t/some-freedom-studio-qemu-annoyances/5561/5 "2022-01-24T20:53:30Z")

</div>

> [@tgm](#):
>
> printf(“123\r\n456\r\n789\r\n”);

No change at all (even reversing \n \r order).

> [@tgm](#):
>
> have you enabled instruction stepping mode?

What do you mean ? For stepping I use F5 and F6 keyboard key.

---

<div class="post-metadata">

**Author:** ![nick.knight](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/nick.knight/32/1046_2.png) [@nick.knight](https://forums.sifive.com/u/nick.knight)\
**Post date:** [January 24, 2022, 9:02pm UTC](https://forums.sifive.com/t/some-freedom-studio-qemu-annoyances/5561/6 "2022-01-24T21:02:53Z")

</div>

> <https://github.com/sifive/freedom-metal/pull/432>
>
> \`\_write\` is returning \`0\` instead of the expected number of characters written.
> …
> 
> One of the consequences is that
> \`\`\`
> printf("string1\\nstring2\\n")
> \`\`\`
> will only output:
> \`\`\`
> string1\\n
> \`\`\`
> because \`printf\` will abort after the first \`\_write\` call.
> 
> This was fixed by @loiclefort on a downstream (private) fork, but that fix was apparently never upstreamed. It was reported recently in the SiFive forums: https://forums.sifive.com/t/some-freedom-studio-qemu-annoyances/5561

---

<div class="post-metadata">

**Author:** ![tgm](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@tgm](https://forums.sifive.com/u/tgm)\
**Post date:** [January 24, 2022, 9:22pm UTC](https://forums.sifive.com/t/some-freedom-studio-qemu-annoyances/5561/7 "2022-01-24T21:22:47Z")

</div>

The issue linked by @nick.knight above explains the problem that you’re having with `printf()`.

Maybe you can use a standalone simple `printf()` instead?  
For example:

> **[GitHub - mpaland/printf: Tiny, fast, non-dependent and fully loaded printf...](https://github.com/mpaland/printf)**
>
> Tiny, fast, non-dependent and fully loaded printf implementation for embedded systems. Extensive test suite passing. - GitHub - mpaland/printf: Tiny, fast, non-dependent and fully loaded printf imp...

There are many others out there.

> What do you mean ?

See here for how to enable instruction stepping mode:

[https://rtist.hcldoc.com/help/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Ftasks%2Fcdt\_t\_disassembly.htm](https://rtist.hcldoc.com/help/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Ftasks%2Fcdt_t_disassembly.htm)

---

<div class="post-metadata">

**Author:** ![abirtz](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@abirtz](https://forums.sifive.com/u/abirtz)\
**Post date:** [January 26, 2022, 1:22pm UTC](https://forums.sifive.com/t/some-freedom-studio-qemu-annoyances/5561/8 "2022-01-26T13:22:36Z")

</div>

In “Disassembly” window without source code everything work fine: breakpoint are set at the right place and step instruction is also done at the right place.  
But follow the execution in “Disassembly” window is not so easy than follow the execution in editor window.  
Unfortunatly for large .S file the PC arrow is at the wrong instruction in editor window. The regsiter window then give wrong value.  
The break point in the first screenshot is set at the line 1643 but the debugger has stopped at 1650, in advance of 7 instructions.  
And the PC (shown by blue arrow) is not at this line but at line 1682.

Yes, we can ignore the editor window and work only with “Disassembly” window but working in editor window is much more easy since we see the source code.  
Adding source code in “Disassembly” window does not help as you see in the second screenshot since source code is completely desynchronized.

---

<div class="post-metadata">

**Author:** ![tgm](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@tgm](https://forums.sifive.com/u/tgm)\
**Post date:** [January 26, 2022, 1:55pm UTC](https://forums.sifive.com/t/some-freedom-studio-qemu-annoyances/5561/9 "2022-01-26T13:55:26Z")

</div>

What optimization level are you compiling with?  
Hopefully -O0 or -Og?  
If you’re using something else then high level source line tracking may not work as you expect.

---

<div class="post-metadata">

**Author:** ![abirtz](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@abirtz](https://forums.sifive.com/u/abirtz)\
**Post date:** [January 26, 2022, 9:06pm UTC](https://forums.sifive.com/t/some-freedom-studio-qemu-annoyances/5561/10 "2022-01-26T21:06:58Z")

</div>

Where in Freedom Studio can I get the optimization level ?

[http://en.ica123.com/risc-v-c-programming-1-（1）use-freedom-studio-to-create-a-new-project/](http://en.ica123.com/risc-v-c-programming-1-%EF%BC%881%EF%BC%89use-freedom-studio-to-create-a-new-project/)

show the optimization level can be found in project Properties → C/C++ Build → Properties → Optimization

 ![opt_1](https://us1.discourse-cdn.com/flex020/uploads/sifive/original/2X/7/7d5ab4d96e1e358d7727640f28cbed302a742610.png)

but the same window in my project don’t show any Optimization

 ![opt_2](https://us1.discourse-cdn.com/flex020/uploads/sifive/original/2X/c/cecd70ad70d62b0505bcfaa785c1fb4a4fff4965.png)

---

<div class="post-metadata">

**Author:** ![tgm](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@tgm](https://forums.sifive.com/u/tgm)\
**Post date:** [January 26, 2022, 9:41pm UTC](https://forums.sifive.com/t/some-freedom-studio-qemu-annoyances/5561/11 "2022-01-26T21:41:29Z")

</div>

Are you using a Makefile project rather than a Managed Make project? If so then the optimization level will presumably be specified in your Makefile rather than the project settings.

This article touches on the differences between Eclipse CDT Makefile projects and Managed Make projects. It’s not Freedom Studio specific but the general principles apply to most Eclipse/CDT based IDEs.

> **[Tutorial: Makefile Projects with Eclipse](https://mcuoneclipse.com/2017/07/22/tutorial-makefile-projects-with-eclipse/)**
>
> The benefit of an IDE like Eclipse is: it makes working with projects very easy, as generates make files and it takes and automatically manages the make file(s). But sometimes this might not be wha…

---

<div class="post-metadata">

**Author:** ![abirtz](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@abirtz](https://forums.sifive.com/u/abirtz)\
**Post date:** [January 27, 2022, 4:08pm UTC](https://forums.sifive.com/t/some-freedom-studio-qemu-annoyances/5561/12 "2022-01-27T16:08:20Z")

</div>

The first Makefile I found is “qemu\_sifive\_s51\_sifive\_welcome” in “src” do not hold any reference to optimization level.

The second (in "scripts) hold a only a comment to optimization level

```
# Benchmark CFLAGS go after loading the CONFIGURATION so that they can override the optimization level

```

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* first Makefile

# Copyright 2019 SiFive, Inc

# SPDX-License-Identifier: Apache-2.0

PROGRAM ?= sifive-welcome

$(PROGRAM): $(wildcard \*.c) $(wildcard \*.h) $(wildcard \*.S)

clean:  
rm -f $(PROGRAM) $(PROGRAM).hex

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* second Makefile

PROGRAM = sifive-welcome  
TARGET = qemu-sifive-s51

# The configuration defaults to Debug. Valid choices are:

# - debug

# - release

CONFIGURATION ?= debug

#############################################################

# Makefile Arguments

#############################################################

# BSP\_DIR sets the path to the target-specific board support package.

BSP\_DIR ?= $(abspath bsp)

# SRC\_DIR sets the path to the program source directory

SRC\_DIR ?= $(abspath src)

# FREERTOS\_SOURCE\_PATH sets the path to the FreeRTOS source directory

export FREERTOS\_SOURCE\_PATH = $(abspath FreeRTOS-metal)

# Set FREEDOM\_E\_SDK\_VENV\_PATH to use a project-local virtualenv

export FREEDOM\_E\_SDK\_VENV\_PATH ?= $(abspath .)/venv

# Set FREERTOS\_METAL\_VENV\_PATH to use same venv as FREEDOM\_E\_SDK\_VENV\_PATH

export FREERTOS\_METAL\_VENV\_PATH ?= $(FREEDOM\_E\_SDK\_VENV\_PATH)

# SYSTEMVIEW\_SOURCE\_PATH sets the path to the SEGGER SystemView source directory

export SYSTEMVIEW\_SOURCE\_PATH = $(abspath Segger\_SystemView-metal)

# SCL\_SOURCE\_PATH sets the path to the SCL source directory

export SCL\_SOURCE\_PATH = $(abspath scl-metal)

#############################################################

# BSP loading

#############################################################

# There must be a settings makefile fragment in the BSP’s board directory.

ifeq ($(wildcard $(BSP\_DIR)/settings.mk),)  
$(error Unable to find BSP for $(TARGET), expected to find $(BSP\_DIR)/settings.mk)  
endif

# Include the BSP settings

include $(BSP\_DIR)/settings.mk

# Check that settings.mk sets RISCV\_ARCH and RISCV\_ABI

ifeq ($(RISCV\_ARCH),)  
$(error $(BSP\_DIR)/board.mk must set RISCV\_ARCH, the RISC-V ISA string to target)  
endif

ifeq ($(RISCV\_ABI),)  
$(error $(BSP\_DIR)/board.mk must set RISCV\_ABI, the ABI to target)  
endif

ifeq ($(RISCV\_CMODEL),)  
RISCV\_CMODEL = medany  
endif

ifeq ($(RISCV\_LIBC),)  
RISCV\_LIBC=nano  
endif

ifeq ($(RISCV\_LIBC),segger)

# Disable format string errors when building with -Werror

RISCV\_CFLAGS += -Wno-error=format=

LIBMETAL\_EXTRA=-lmetal-segger  
METAL\_WITH\_EXTRA=–with-builtin-libmetal-segger  
SPEC=gloss-segger  
endif

ifeq ($(RISCV\_LIBC),nano)  
LIBMETAL\_EXTRA=-lmetal-gloss  
METAL\_WITH\_EXTRA=–with-builtin-libgloss  
SPEC=nano  
endif

ifeq ($(SPEC),)  
$(error RISCV\_LIBC set to an unsupported value: $(RISCV\_LIBC))  
endif

ifeq ($(PROGRAM),dhrystone)  
ifeq ($(LINK\_TARGET),)  
ifneq ($(TARGET),freedom-e310-arty)  
ifneq ($(TARGET),sifive-hifive1)  
ifneq ($(TARGET),sifive-hifive1-revb)  
LINK\_TARGET = ramrodata  
endif  
endif  
endif  
endif  
endif

ifeq ($(PROGRAM),coremark)  
ifeq ($(LINK\_TARGET),)  
LINK\_TARGET = ramrodata  
endif  
endif

ifneq ($(findstring freertos,$(PROGRAM)),)  
ifeq ($(LINK\_TARGET),)  
LINK\_TARGET = freertos  
endif  
endif

ifeq ($(LINK\_TARGET),)  
LINK\_TARGET = default  
endif

# Determines the XLEN from the toolchain tuple

ifeq ($(patsubst rv32%,rv32,$(RISCV\_ARCH)),rv32)  
RISCV\_XLEN := 32  
else ifeq ($(patsubst rv64%,rv64,$(RISCV\_ARCH)),rv64)  
RISCV\_XLEN := 64  
else  
$(error Unable to determine XLEN from $(RISCV\_ARCH))  
endif

MTIME\_RATE\_HZ\_DEF=32768  
ifeq ($(findstring qemu,$(TARGET)),qemu)  
MTIME\_RATE\_HZ\_DEF=10000000  
else  
ifeq ($(findstring unleashed,$(TARGET)),unleashed)  
MTIME\_RATE\_HZ\_DEF=1000000  
endif  
endif

#############################################################

# Toolchain

#############################################################

# Allow users to select a different cross compiler.

CROSS\_COMPILE ?= riscv64-unknown-elf

# If users don’t specify RISCV\_PATH then assume that the tools will just be in

# their path.

ifeq ($(RISCV\_PATH),)  
RISCV\_GCC := $(CROSS\_COMPILE)-gcc  
RISCV\_GXX := $(CROSS\_COMPILE)-g++  
RISCV\_OBJDUMP := $(CROSS\_COMPILE)-objdump  
RISCV\_OBJCOPY := $(CROSS\_COMPILE)-objcopy  
RISCV\_GDB := $(CROSS\_COMPILE)-gdb  
RISCV\_AR := $(CROSS\_COMPILE)-ar  
RISCV\_SIZE := $(CROSS\_COMPILE)-size  
else  
RISCV\_GCC := $(abspath $(RISCV\_PATH)/bin/$(CROSS\_COMPILE)-gcc)  
RISCV\_GXX := $(abspath $(RISCV\_PATH)/bin/$(CROSS\_COMPILE)-g++)  
RISCV\_OBJDUMP := $(abspath $(RISCV\_PATH)/bin/$(CROSS\_COMPILE)-objdump)  
RISCV\_OBJCOPY := $(abspath $(RISCV\_PATH)/bin/$(CROSS\_COMPILE)-objcopy)  
RISCV\_GDB := $(abspath $(RISCV\_PATH)/bin/$(CROSS\_COMPILE)-gdb)  
RISCV\_AR := $(abspath $(RISCV\_PATH)/bin/$(CROSS\_COMPILE)-ar)  
RISCV\_SIZE := $(abspath $(RISCV\_PATH)/bin/$(CROSS\_COMPILE)-size)  
PATH := $(abspath $(RISCV\_PATH)/bin):$(PATH)  
endif

SEGGER\_JLINK\_EXE := JLinkExe  
SEGGER\_JLINK\_GDB\_SERVER := JLinkGDBServer

QEMU\_RISCV32 = qemu-system-riscv32  
QEMU\_RISCV64 = qemu-system-riscv64

#############################################################

# Software Flags

#############################################################

# Set the arch, ABI, and code model

RISCV\_CCASFLAGS += -march=$(RISCV\_ARCH) -mabi=$(RISCV\_ABI) -mcmodel=$(RISCV\_CMODEL)  
RISCV\_CFLAGS += -march=$(RISCV\_ARCH) -mabi=$(RISCV\_ABI) -mcmodel=$(RISCV\_CMODEL)  
RISCV\_CXXFLAGS += -march=$(RISCV\_ARCH) -mabi=$(RISCV\_ABI) -mcmodel=$(RISCV\_CMODEL)  
RISCV\_ASFLAGS += -march=$(RISCV\_ARCH) -mabi=$(RISCV\_ABI) -mcmodel=$(RISCV\_CMODEL)

# Prune unused functions and data

ifeq ($(RISCV\_SERIES),sifive-8-series)  
ifeq ($(PROGRAM),dhrystone)  
RISCV\_CFLAGS += -fno-function-sections -fno-data-sections  
RISCV\_CXXFLAGS += -fno-function-sections -fno-data-sections  
else  
RISCV\_CFLAGS += -ffunction-sections -fdata-sections  
RISCV\_CXXFLAGS += -ffunction-sections -fdata-sections  
endif  
else  
RISCV\_CFLAGS += -ffunction-sections -fdata-sections  
RISCV\_CXXFLAGS += -ffunction-sections -fdata-sections  
endif

# Include the Metal headers

RISCV\_CCASFLAGS += -I$(abspath $(BSP\_DIR)/install/include/)  
RISCV\_CFLAGS += -I$(abspath $(BSP\_DIR)/install/include/)  
RISCV\_CXXFLAGS += -I$(abspath $(BSP\_DIR)/install/include/)

# Reference selected library

RISCV\_ASFLAGS += --specs=$(SPEC).specs  
RISCV\_CCASFLAGS += --specs=$(SPEC).specs  
RISCV\_CFLAGS += --specs=$(SPEC).specs  
RISCV\_CXXFLAGS += --specs=$(SPEC).specs

# Set the MTIME frequency

RISCV\_CFLAGS += -DMTIME\_RATE\_HZ\_DEF=$(MTIME\_RATE\_HZ\_DEF)  
RISCV\_CXXFLAGS += -DMTIME\_RATE\_HZ\_DEF=$(MTIME\_RATE\_HZ\_DEF)

RISCV\_CFLAGS += -fcommon

# Turn on garbage collection for unused sections

RISCV\_LDFLAGS += -Wl,–gc-sections

# Turn on linker map file generation

RISCV\_LDFLAGS += -Wl,-Map,$(PROGRAM).map

# Turn off the C standard library

RISCV\_LDFLAGS += -nostartfiles -nostdlib

# Find the archive files and linker scripts

RISCV\_LDFLAGS += -L$(sort $(dir $(abspath $(filter %.a,$^)))) -T$(abspath $(filter %.lds,$^))

# Link to the relevant libraries

RISCV\_LDLIBS += -Wl,–start-group -lc -lgcc -lm -lmetal $(LIBMETAL\_EXTRA) -Wl,–end-group

# Load the configuration Makefile

CONFIGURATION\_FILE = $(wildcard $(CONFIGURATION).mk)  
ifeq ($(words $(CONFIGURATION\_FILE)),0)  
$(error Unable to find the Makefile $(CONFIGURATION).mk for CONFIGURATION=$(CONFIGURATION))  
endif  
include $(CONFIGURATION).mk

# Benchmark CFLAGS go after loading the CONFIGURATION so that they can override the optimization level

# Checking if we use gcc-10 or not, which need different compiler options for better benchmark scores

GCC\_VER\_GTE10 := $(shell echo `${RISCV_GCC} -dumpversion | cut -f1-2 -d.` \>= 10 | bc )

ifeq ($(PROGRAM),dhrystone)  
ifeq ($(DHRY\_OPTION),)

# Ground rules (default)

RISCV\_XCFLAGS += -mexplicit-relocs -fno-inline  
else ifeq ($(DHRY\_OPTION),fast)

# With inline and without lto

RISCV\_XCFLAGS += -mexplicit-relocs -finline  
else ifeq ($(DHRY\_OPTION),best)

# Best Score

RISCV\_XCFLAGS += -finline -flto -fwhole-program  
endif  
RISCV\_XCFLAGS += -DDHRY\_ITERS=$(TARGET\_DHRY\_ITERS)  
endif

ifeq ($(PROGRAM),coremark)  
ifeq ($(RISCV\_SERIES),$(filter $(RISCV\_SERIES),sifive-7-series sifive-8-series))

# 8-series currently uses 7-series mtune, but this may change

RISCV\_XCFLAGS += -O2 -fno-common -funroll-loops -finline-functions -funroll-all-loops -falign-functions=8 -falign-jumps=8 -falign-loops=8 -finline-limit=1000 -mtune=sifive-7-series -ffast-math  
else  
ifeq ($(RISCV\_XLEN),32)  
RISCV\_XCFLAGS += -O2 -fno-common -funroll-loops -finline-functions -falign-functions=16 -falign-jumps=4 -falign-loops=4 -finline-limit=1000 -fno-if-conversion2 -fselective-scheduling -fno-tree-dominator-opts -fno-reg-struct-return -fno-rename-registers --param case-values-threshold=8 -fno-crossjumping -freorder-blocks-and-partition -fno-tree-loop-if-convert -fno-tree-sink -fgcse-sm -fno-strict-overflow  
else  
RISCV\_XCFLAGS += -O2 -fno-common -funroll-loops -finline-functions -falign-functions=16 -falign-jumps=4 -falign-loops=4 -finline-limit=1000 -fno-if-conversion2 -fselective-scheduling -fno-tree-dominator-opts  
endif # RISCV\_XLEN==32  
endif # RISCV\_SERIES==sifive-7-series|sifive-8-series  
RISCV\_XCFLAGS += -DITERATIONS=$(TARGET\_CORE\_ITERS)  
ifeq ($(GCC\_VER\_GTE10),1)

# additional options for gcc-10 to get better performance

RISCV\_XCFLAGS += -fno-tree-loop-distribute-patterns --param fsm-scale-path-stmts=3  
endif # GCC\_VER\_GTE10==1  
endif # PROGRAM==coremark

ifeq ($(findstring freertos,$(PROGRAM)),freertos)  
RISCV\_XCFLAGS += -DWAIT\_MS=$(TARGET\_FREERTOS\_WAIT\_MS)  
endif

ifneq ($(filter rtl,$(TARGET\_TAGS)),)  
RISCV\_XCFLAGS += -DHCA\_BYPASS\_TRNG  
endif

# A method to pass cycle delay

RISCV\_XCFLAGS += -DMETAL\_WAIT\_CYCLE=$(TARGET\_INTR\_WAIT\_CYCLE)

#############################################################

# Software

#############################################################

PROGRAM\_ELF ?= $(SRC\_DIR)/$(CONFIGURATION)/$(PROGRAM).elf  
PROGRAM\_HEX ?= $(SRC\_DIR)/$(CONFIGURATION)/$(PROGRAM).hex  
PROGRAM\_LST ?= $(SRC\_DIR)/$(CONFIGURATION)/$(PROGRAM).lst

.PHONY: all  
all: software

.PHONY: software  
software: $(PROGRAM\_ELF)

software: $(PROGRAM\_HEX)

PROGRAM\_SRCS = $(wildcard $(SRC\_DIR)/_.c) $(wildcard $(SRC\_DIR)/_.h) $(wildcard $(SRC\_DIR)/\*.S)

$(PROGRAM\_ELF):   
$(PROGRAM\_SRCS)   
$(BSP\_DIR)/install/lib/$(CONFIGURATION)/libmetal.a   
$(BSP\_DIR)/install/lib/$(CONFIGURATION)/libmetal-gloss.a   
$(BSP\_DIR)/metal.$(LINK\_TARGET).lds  
mkdir -p $(dir $@)  
$(MAKE) -C $(SRC\_DIR) $(basename $(notdir $@))   
PORT\_DIR=$(PORT\_DIR)   
PROGRAM=$(PROGRAM)   
AR=$(RISCV\_AR)   
CC=$(RISCV\_GCC)   
CXX=$(RISCV\_GXX)   
ASFLAGS=“$(RISCV\_ASFLAGS)”   
CCASFLAGS=“$(RISCV\_CCASFLAGS)”   
CFLAGS=“$(RISCV\_CFLAGS)”   
CXXFLAGS=“$(RISCV\_CXXFLAGS)”   
XCFLAGS=“$(RISCV\_XCFLAGS)”   
LDFLAGS=“$(RISCV\_LDFLAGS)”   
LDLIBS=“$(RISCV\_LDLIBS)”   
FREERTOS\_METAL\_VENV\_PATH=“$(FREERTOS\_METAL\_VENV\_PATH)”  
mv $(SRC\_DIR)/$(basename $(notdir $@)) $@  
mv $(SRC\_DIR)/$(basename $(notdir $@)).map $(dir $@)  
touch -c $@  
$(RISCV\_OBJDUMP) --source --all-headers --demangle --line-numbers --wide $@ \> $(PROGRAM\_LST)  
$(RISCV\_SIZE) $@

# Use elf2hex if we’re creating a hex file for RTL simulation

ifneq ($(filter rtl,$(TARGET\_TAGS)),)  
.PHONY: software  
$(PROGRAM\_HEX):   
scripts/elf2hex/install/bin/$(CROSS\_COMPILE)-elf2hex   
$(PROGRAM\_ELF)  
$\< --output $@ --input $(PROGRAM\_ELF) --bit-width $(COREIP\_MEM\_WIDTH)  
else  
$(PROGRAM\_HEX):   
$(PROGRAM\_ELF)  
$(RISCV\_OBJCOPY) -O ihex $(PROGRAM\_ELF) $@  
endif

.PHONY: clean-software  
clean-software:  
$(MAKE) -C $(SRC\_DIR) PORT\_DIR=$(PORT\_DIR) clean  
rm -rf $(SRC\_DIR)/$(CONFIGURATION)  
.PHONY: clean  
clean: clean-software

#############################################################

# elf2hex

#############################################################  
scripts/elf2hex/build/Makefile: scripts/elf2hex/configure  
@rm -rf $(dir $@)  
@mkdir -p $(dir $@)  
cd $(dir $@);   
$(abspath $\<)   
–prefix=$(abspath $(dir $\<))/install   
–target=$(CROSS\_COMPILE)

scripts/elf2hex/install/bin/$(CROSS\_COMPILE)-elf2hex: scripts/elf2hex/build/Makefile  
$(MAKE) -C $(dir $\<) install  
touch -c $@

.PHONY: clean-elf2hex  
clean-elf2hex:  
rm -rf scripts/elf2hex/build scripts/elf2hex/install  
clean: clean-elf2hex

#############################################################

# Compiles an instance of Metal targeted at $(TARGET)

#############################################################  
METAL\_SOURCE\_PATH ?= freedom-metal  
METAL\_HEADER = $(BSP\_DIR)/metal.h  
METAL\_INLINE = $(BSP\_DIR)/metal-inline.h  
PLATFORM\_HEADER = $(BSP\_DIR)/metal-platform.h

METAL\_PREFIX = $(abspath $(BSP\_DIR)/install)  
METAL\_BUILD\_DIR = $(abspath $(BSP\_DIR)/build/$(CONFIGURATION))  
METAL\_LIB\_DIR = $(abspath $(BSP\_DIR)/install/lib/$(CONFIGURATION))

METAL\_HEADER\_GENERATOR = freedom-metal\_header-generator  
BARE\_HEADER\_GENERATOR = freedom-bare\_header-generator

OVERLAY\_GENERATOR = scripts/devicetree-overlay-generator/generate\_overlay.py  
LDSCRIPT\_GENERATOR = scripts/ldscript-generator/generate\_ldscript.py  
CMSIS\_SVD\_GENERATOR = scripts/cmsis-svd-generator/generate\_svd.py  
SETTINGS\_GENERATOR = scripts/esdk-settings-generator/generate\_settings.py

# Metal BSP file generation

# 

# Requires devicetree compiler (dtc) and freedom-devicetree-tools to be in the

# PATH, otherwise the existing files are used.

# 

# This allows user changes to the devicetree in $(BSP\_DIR)/design.dts to be

# propagated through to the end application with a single invocation of Make

$(BSP\_DIR)/design.dts: $(BSP\_DIR)/core.dts $(OVERLAY\_GENERATOR)  
$(MAKE) -f scripts/virtualenv.mk virtualenv  
. $(FREEDOM\_E\_SDK\_VENV\_PATH)/bin/activate && $(OVERLAY\_GENERATOR) --type $(TARGET) --output $@ --rename-include $(notdir $\<) $\<

$(BSP\_DIR)/metal.default.lds: $(BSP\_DIR)/design.dts $(LDSCRIPT\_GENERATOR)  
$(MAKE) -f scripts/virtualenv.mk virtualenv  
. $(FREEDOM\_E\_SDK\_VENV\_PATH)/bin/activate && $(LDSCRIPT\_GENERATOR) -d $\< -o $@

$(BSP\_DIR)/metal.ramrodata.lds: $(BSP\_DIR)/design.dts $(LDSCRIPT\_GENERATOR)  
$(MAKE) -f scripts/virtualenv.mk virtualenv  
. $(FREEDOM\_E\_SDK\_VENV\_PATH)/bin/activate && $(LDSCRIPT\_GENERATOR) -d $\< -o $@ --ramrodata

$(BSP\_DIR)/metal.scratchpad.lds: $(BSP\_DIR)/design.dts $(LDSCRIPT\_GENERATOR)  
$(MAKE) -f scripts/virtualenv.mk virtualenv  
. $(FREEDOM\_E\_SDK\_VENV\_PATH)/bin/activate && $(LDSCRIPT\_GENERATOR) -d $\< -o $@ --scratchpad

$(BSP\_DIR)/metal.freertos.lds: $(BSP\_DIR)/design.dts $(LDSCRIPT\_GENERATOR)  
$(MAKE) -f scripts/virtualenv.mk virtualenv  
. $(FREEDOM\_E\_SDK\_VENV\_PATH)/bin/activate && $(LDSCRIPT\_GENERATOR) -d $\< -o $@ --freertos

$(BSP\_DIR)/design.svd: $(BSP\_DIR)/design.dts $(CMSIS\_SVD\_GENERATOR)  
$(MAKE) -f scripts/virtualenv.mk virtualenv  
. $(FREEDOM\_E\_SDK\_VENV\_PATH)/bin/activate && $(CMSIS\_SVD\_GENERATOR) -d $\< -o $@

$(BSP\_DIR)/settings.mk: $(BSP\_DIR)/design.dts $(SETTINGS\_GENERATOR)  
$(MAKE) -f scripts/virtualenv.mk virtualenv  
. $(FREEDOM\_E\_SDK\_VENV\_PATH)/bin/activate && $(SETTINGS\_GENERATOR) -d $\< -o $@ -t $(TARGET)

ifeq ($(findstring spike,$(TARGET)),spike)  
$(BSP\_DIR)/spike\_options.sh:  
echo “export SPIKE\_OPTIONS=""” \> $@

ifneq ($(shell which spike),)  
$(BSP\_DIR)/core.dts: $(BSP\_DIR)/spike\_options.sh  
. $\< && scripts/spikedts $@  
endif # which spike  
endif # findstring spike,$(TARGET)

ifneq ($(shell which dtc),)  
ifneq ($(shell which $(METAL\_HEADER\_GENERATOR)),)

$(BSP\_DIR)/design.dtb: $(BSP\_DIR)/design.dts  
cd $(dir $@) && dtc -I dts -O dtb -o $(notdir $@) $(notdir $\<)

$(METAL\_INLINE): $(BSP\_DIR)/design.dtb  
$(METAL\_HEADER): $(BSP\_DIR)/design.dtb  
cd $(dir $@) && $(METAL\_HEADER\_GENERATOR) -d $(notdir $\<) -o $(notdir $@)

$(PLATFORM\_HEADER): $(BSP\_DIR)/design.dtb  
cd $(dir $@) && $(BARE\_HEADER\_GENERATOR) -d $(notdir $\<) -o $(notdir $@)

.PHONY: bsp  
metal-bsp:  
$(METAL\_HEADER) $(METAL\_INLINE) $(PLATFORM\_HEADER)   
$(BSP\_DIR)/metal.default.lds   
$(BSP\_DIR)/metal.ramrodata.lds   
$(BSP\_DIR)/metal.scratchpad.lds   
$(BSP\_DIR)/metal.freertos.lds   
$(BSP\_DIR)/settings.mk  
else  
.PHONY: bsp  
metal-bsp:  
@echo “Make cannot generate a BSP because it cannot find freedom-devicetree-tools”  
@exit 1  
endif # which $(METAL\_HEADER\_GENERATOR)  
else  
.PHONY: bsp  
metal-bsp:  
@echo “Make cannot generate a BSP because it cannot find dtc”  
@exit 1  
endif # which dtc

.PHONY: metal  
metal: $(METAL\_LIB\_DIR)/stamp

$(METAL\_BUILD\_DIR)/Makefile:   
$(METAL\_HEADER) $(METAL\_INLINE) $(PLATFORM\_HEADER)   
$(BSP\_DIR)/settings.mk  
@rm -rf $(dir $@)  
@mkdir -p $(dir $@)  
cd $(dir $@) &&   
CFLAGS=“$(RISCV\_CFLAGS)”   
$(abspath $(METAL\_SOURCE\_PATH)/configure)   
–host=$(CROSS\_COMPILE)   
–prefix=$(METAL\_PREFIX)   
–libdir=$(METAL\_LIB\_DIR)   
$(METAL\_WITH\_EXTRA)   
–with-machine-header=$(abspath $(METAL\_HEADER))   
–with-machine-inline=$(abspath $(METAL\_INLINE))   
–with-platform-header=$(abspath $(PLATFORM\_HEADER))  
touch -c $@

$(METAL\_LIB\_DIR)/stamp: $(METAL\_BUILD\_DIR)/Makefile  
$(MAKE) -C $(METAL\_BUILD\_DIR) install  
date \> $@

$(METAL\_LIB\_DIR)/lib%.a: $(METAL\_LIB\_DIR)/stamp ;@:

# If we’re cleaning the last Metal library for a TARGET, then remove

# the install directory, otherwise just remove the built libs for that

# CONFIGURATION.

ifeq ($(words $(wildcard $(METAL\_PREFIX)/lib/\*)),1)  
METAL\_CLEAN = $(METAL\_PREFIX)  
else  
METAL\_CLEAN = $(METAL\_LIB\_DIR)  
endif

.PHONY: clean-metal  
clean-metal:  
rm -rf $(METAL\_CLEAN)  
rm -rf $(METAL\_BUILD\_DIR)  
clean: clean-metal

metal\_install: metal  
$(MAKE) -C $(METAL\_SOURCE\_PATH) install

---

<div class="post-metadata">

**Author:** ![tgm](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@tgm](https://forums.sifive.com/u/tgm)\
**Post date:** [January 27, 2022, 4:26pm UTC](https://forums.sifive.com/t/some-freedom-studio-qemu-annoyances/5561/13 "2022-01-27T16:26:44Z")

</div>

When you build your project the build console output should clarify what optimization options are used.

---

<div class="post-metadata">

**Author:** ![abirtz](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@abirtz](https://forums.sifive.com/u/abirtz)\
**Post date:** [January 28, 2022, 2:36pm UTC](https://forums.sifive.com/t/some-freedom-studio-qemu-annoyances/5561/14 "2022-01-28T14:36:25Z")

</div>

> [@tgm](#):
>
> build console output

There are a lot -O0 but no -Og.

* * *

09:22:40 \*\*\*\* Build of configuration debug for project qemu\_sifive\_s51\_sifive\_welcome \*\*\*\*  
make all CONFIGURATION=debug  
cd /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/bsp/build/debug/ &&   
CFLAGS=“-march=rv64imac -mabi=lp64 -mcmodel=medany -ffunction-sections -fdata-sections -I/Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/bsp/install/include --specs=nano.specs -DMTIME\_RATE\_HZ\_DEF=10000000 -fcommon -O0 -g”   
/Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/freedom-metal/configure   
–host=riscv64-unknown-elf   
–prefix=/Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/bsp/install   
–libdir=/Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/bsp/install/lib/debug   
–with-builtin-libgloss   
–with-machine-header=/Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/bsp/metal.h   
–with-machine-inline=/Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/bsp/metal-inline.h   
–with-platform-header=/Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/bsp/metal-platform.h  
checking for a BSD-compatible install… /usr/bin/install -c  
checking whether build environment is sane… yes  
checking for riscv64-unknown-elf-strip… riscv64-unknown-elf-strip  
checking for a thread-safe mkdir -p… /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/freedom-metal/install-sh -c -d  
checking for gawk… no  
checking for mawk… no  
checking for nawk… no  
checking for awk… awk  
checking whether make sets $(MAKE)… yes  
checking whether make supports nested variables… yes  
checking whether to enable maintainer-specific portions of Makefiles… no  
checking build system type… x86\_64-apple-darwin20.1.0  
checking host system type… riscv64-unknown-elf  
checking for riscv64-unknown-elf-gcc… riscv64-unknown-elf-gcc  
checking whether the C compiler works… yes  
checking for C compiler default output file name… a.out  
checking for suffix of executables…  
checking whether we are cross compiling… yes  
checking for suffix of object files… o  
checking whether we are using the GNU C compiler… yes  
checking whether riscv64-unknown-elf-gcc accepts -g… yes  
checking for riscv64-unknown-elf-gcc option to accept ISO C89… none needed  
checking whether riscv64-unknown-elf-gcc understands -c and -o together… yes  
checking for style of include used by make… GNU  
checking dependency style of riscv64-unknown-elf-gcc… gcc3  
checking for riscv64-unknown-elf-ranlib… riscv64-unknown-elf-ranlib  
checking for riscv64-unknown-elf-ar… riscv64-unknown-elf-ar  
checking the archiver (riscv64-unknown-elf-ar) interface… ar  
checking dependency style of riscv64-unknown-elf-gcc… gcc3  
checking that generated files are newer than configure… done  
configure: creating ./config.status  
config.status: creating Makefile  
config.status: executing depfiles commands  
touch -c /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/bsp/build/debug/Makefile  
make -C /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/bsp/build/debug install  
make[1]: Entering directory ‘/Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/bsp/build/debug’  
cp /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/bsp/metal.h metal/machine.h  
cp /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/bsp/metal-inline.h metal/machine/inline.h  
cp /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/bsp/metal-platform.h metal/machine/platform.h  
make install-am  
make[2]: Entering directory ‘/Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/bsp/build/debug’  
depbase=`echo src/drivers/fixed-clock.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;  
riscv64-unknown-elf-gcc -DPACKAGE\_NAME="freedom-metal" -DPACKAGE\_TARNAME="freedom-metal" -DPACKAGE\_VERSION="v0.1.2" -DPACKAGE\_STRING="freedom-metal\ v0.1.2" -DPACKAGE\_BUGREPORT="[https://github.com/sifive/freedom-metal/issues\](https://github.com/sifive/freedom-metal/issues%5C)" -DPACKAGE\_URL="[https://github.com/sifive/freedom-metal\](https://github.com/sifive/freedom-metal%5C)" -DPACKAGE="freedom-metal" -DVERSION="v0.1.2" -I. -I/Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/freedom-metal -march=rv64imac -mabi=lp64 -mcmodel=medany -ffunction-sections -fdata-sections -I/Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/bsp/install/include --specs=nano.specs -DMTIME\_RATE\_HZ\_DEF=10000000 -fcommon -O0 -g -MT src/drivers/fixed-clock.o -MD -MP -MF $depbase.Tpo -c -o src/drivers/fixed-clock.o /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/freedom-metal/src/drivers/fixed-clock.c &&  
mv -f $depbase.Tpo $depbase.Po  
depbase=`echo src/drivers/fixed-factor-clock.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;  
riscv64-unknown-elf-gcc -DPACKAGE\_NAME="freedom-metal" -DPACKAGE\_TARNAME="freedom-metal" -DPACKAGE\_VERSION="v0.1.2" -DPACKAGE\_STRING="freedom-metal\ v0.1.2" -DPACKAGE\_BUGREPORT="[https://github.com/sifive/freedom-metal/issues\](https://github.com/sifive/freedom-metal/issues%5C)" -DPACKAGE\_URL="[https://github.com/sifive/freedom-metal\](https://github.com/sifive/freedom-metal%5C)" -DPACKAGE="freedom-metal" -DVERSION="v0.1.2" -I. -I/Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/freedom-metal -march=rv64imac -mabi=lp64 -mcmodel=medany -ffunction-sections -fdata-sections -I/Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/bsp/install/include --specs=nano.specs -DMTIME\_RATE\_HZ\_DEF=10000000 -fcommon -O0 -g -MT src/drivers/fixed-factor-clock.o -MD -MP -MF $depbase.Tpo -c -o src/drivers/fixed-factor-clock.o /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/freedom-metal/src/drivers/fixed-factor-clock.c &&  
mv -f $depbase.Tpo $depbase.Po  
depbase=`echo src/drivers/inline.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;  
riscv64-unknown-elf-gcc -DPACKAGE\_NAME="freedom-metal" -DPACKAGE\_TARNAME="freedom-metal" -DPACKAGE\_VERSION="v0.1.2" -DPACKAGE\_STRING="freedom-metal\ v0.1.2" -DPACKAGE\_BUGREPORT="[https://github.com/sifive/freedom-metal/issues\](https://github.com/sifive/freedom-metal/issues%5C)" -DPACKAGE\_URL="[https://github.com/sifive/freedom-metal\](https://github.com/sifive/freedom-metal%5C)" -DPACKAGE="freedom-metal" -DVERSION="v0.1.2" -I. -I/Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/freedom-metal -march=rv64imac -mabi=lp64 -mcmodel=medany -ffunction-sections -fdata-sections -I/Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/bsp/install/include --specs=nano.specs -DMTIME\_RATE\_HZ\_DEF=10000000 -fcommon -O0 -g -MT src/drivers/inline.o -MD -MP -MF $depbase.Tpo -c -o src/drivers/inline.o /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/freedom-metal/src/drivers/inline.c &&  
mv -f $depbase.Tpo $depbase.Po  
depbase=`echo src/drivers/riscv_clint0.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;  
riscv64-unknown-elf-gcc -DPACKAGE\_NAME="freedom-metal" -DPACKAGE\_TARNAME="freedom-metal" -DPACKAGE\_VERSION="v0.1.2" -DPACKAGE\_STRING="freedom-metal\ v0.1.2" -DPACKAGE\_BUGREPORT="[https://github.com/sifive/freedom-metal/issues\](https://github.com/sifive/freedom-metal/issues%5C)" -DPACKAGE\_URL="[https://github.com/sifive/freedom-metal\](https://github.com/sifive/freedom-metal%5C)" -DPACKAGE="freedom-metal" -DVERSION="v0.1.2" -I. -I/Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/freedom-metal -march=rv64imac -mabi=lp64 -mcmodel=medany -ffunction-sections -fdata-sections -I/Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/bsp/install/include --specs=nano.specs -DMTIME\_RATE\_HZ\_DEF=10000000 -fcommon -O0 -g -MT src/drivers/riscv\_clint0.o -MD -MP -MF $depbase.Tpo -c -o src/drivers/riscv\_clint0.o /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/freedom-metal/src/drivers/riscv\_clint0.c &&  
mv -f $depbase.Tpo $depbase.Po  
depbase=`echo src/drivers/riscv_cpu.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;  
riscv64-unknown-elf-gcc -DPACKAGE\_NAME="freedom-metal" -DPACKAGE\_TARNAME="freedom-metal" -DPACKAGE\_VERSION="v0.1.2" -DPACKAGE\_STRING="freedom-metal\ v0.1.2" -DPACKAGE\_BUGREPORT="[https://github.com/sifive/freedom-metal/issues\](https://github.com/sifive/freedom-metal/issues%5C)" -DPACKAGE\_URL="[https://github.com/sifive/freedom-metal\](https://github.com/sifive/freedom-metal%5C)" -DPACKAGE="freedom-metal" -DVERSION="v0.1.2" -I. -I/Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/freedom-metal -march=rv64imac -mabi=lp64 -mcmodel=medany -ffunction-sections -fdata-sections -I/Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/bsp/install/include --specs=nano.specs -DMTIME\_RATE\_HZ\_DEF=10000000 -fcommon -O0 -g -MT src/drivers/riscv\_cpu.o -MD -MP -MF $depbase.Tpo -c -o src/drivers/riscv\_cpu.o /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/freedom-metal/src/drivers/riscv\_cpu.c &&\

…

make[1]: Leaving directory ‘/Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/src’  
mv /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/src/sifive-welcome /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/src/debug/sifive-welcome.elf  
mv /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/src/sifive-welcome.map /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/src/debug/  
touch -c /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/src/debug/sifive-welcome.elf  
/Applications/FreedomStudio.app/Contents/Eclipse/SiFive/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8/bin/riscv64-unknown-elf-objdump --source --all-headers --demangle --line-numbers --wide /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/src/debug/sifive-welcome.elf \> /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/src/debug/sifive-welcome.lst  
/Applications/FreedomStudio.app/Contents/Eclipse/SiFive/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8/bin/riscv64-unknown-elf-size /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/src/debug/sifive-welcome.elf  
text data bss dec hex filename  
42448 3056 19912 65416 ff88 /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/src/debug/sifive-welcome.elf  
/Applications/FreedomStudio.app/Contents/Eclipse/SiFive/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8/bin/riscv64-unknown-elf-objcopy -O ihex /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/src/debug/sifive-welcome.elf /Users/alain/wsFreedomStudio/qemu\_sifive\_s51\_sifive\_welcome/src/debug/sifive-welcome.hex

09:22:49 Build Finished. 0 errors, 0 warnings. (took 9s.596ms)
