RISC-V: A Baremetal Introduction using C++. Development Environment

Setup

build_flags = 
-std=c++17
-O2
-g
-Wall
-ffunction-sections
-fno-exceptions
-fno-rtti
-fno-nonansi-builtins
-fno-use-cxa-atexit
-fno-threadsafe-statics
-nostartfiles
-Wl,-Map,blinky.map

Adding a Post Compile Action

extra_scripts = post_build.py
targets = disasm
def after_build(source, target, env): 
""" Run objdump on the target elf file and save the
output in the top dir.
"""
objdump=env.subst("${OBJCOPY}").replace("objcopy","objdump")
src_elf=env.subst("${BUILD_DIR}/${PROGNAME}.elf")
cmd=" ".join([
objdump, "-SC","--file-start-context", "-w",
src_elf,">","${PROGNAME}.disasm"]) #
env.Execute(cmd)
Import("env")env.AddCustomTarget(
"disasm",
"${BUILD_DIR}/${PROGNAME}.elf",
after_build,
title="Disasm 2",
description="Generate a disassembly file on demand",
always_build=True
)

Other C++ Development Environments

Other RISC-V Devices

--

--

--

Software Engineer, Software Architect, Embedded Systems, Distributed Systems, Digital Design, ソフトウェアエンジニア http://www.linkedin.com/in/phil-mulholland-884a8

Love podcasts or audiobooks? Learn on the go with our new app.

Integrating Grafana with Prometheus and K8S

Ping Google but not Facebook-editing Routing Table

PINKPANDA Week 2 Project Update

Bookdown Examples

Shortest Unique Prefix- Python Solution

Evaluating and Upgrading the Pioneer Challenger Decks

Start testing with PHPT tests in PHPUnit

How to Generate Random Numbers in Excel

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Phil Mulholland

Phil Mulholland

Software Engineer, Software Architect, Embedded Systems, Distributed Systems, Digital Design, ソフトウェアエンジニア http://www.linkedin.com/in/phil-mulholland-884a8

More from Medium

The Road from Code to Executable

Codding Project on C++ language — by Anish

Friendly Introduction Pointers in C++

Core Embedded Systems Skill: Bitwise Operation