Monthly Archives: September 2018

TSM_Alg

Algorithmische Geometrie
Algorithmische Geometrie, Sommersemester 2014
Computational Geometry, Summer 2018

Geometric Algorithms (INFOGA) 2018, Block 2, Frank Staals

Vier Lerntypen

Wahrnehmung
Die vier Lerntypen
Die vier Lerntypen – der auditive Lerntyp
Die vier Lerntypen – der visuelle Lerntyp
Die vier Lerntypen – der haptische Lerntyp
Die vier Lerntypen – der kommunikative Lerntyp

Erster Teil

Algorithmen 1

Algorithmen 1, Vorlesung, SS 2019, 27.07.2019
21: Übung: Ameisenalgorithmen, Vertex Cover, Nachbarschaftsmetaheuristiken, 2.07.2017

Algorithmen 2

Algorithmen 2, Vorlesung, WS2017/18, 08.02.2018
Algorithmen 2, WS 2018/19, 01.08.2019
19: Geometrische Algorithmen, Streckenschnitt, Überlappungen, 07.02.2019
20: Streckenschnitt, Konvexe Hülle, Geometrische Methoden, Übung, 12.02.2019
23: Online Algorithmen, Geometrische Algorithmen, Streckenschnitt, 26.01.2017
24: Konvexe Hüllen, Bereichssuche, Kleinste einschließende Kugel, 26.01.2017
25: Wavelet Tree, Sweepline, Linienschnitt, Geometrische Algorithmen,01.02.2017

Das Sweep-Verfahren der algorithmischen Geometrie
Closest Pair of Points | Divide and Conquer | GeeksforGeeks
Computational Geometry Lec 4 ( Sweep Line Algorithm ) ( in Arabic )
Computational Geometry – Line Sweep – 2 – Segments Intersection (Arabic)
Sweep line algorithm part 1
Sweep line algorithm part 2
Coding Math: Episode 32 – Line Intersections Part I
Coding Math: Episode 33 – Line Intersections Part II
11 2 Line Segment Intersection 546
11 1 1d Range Search 851
11 3 Kd Trees 2907
11 4 Interval Search Trees 1347

Given n line segments, find if any two segments intersect
Algorithmen und Datenstrukturen – Suchbaum (PDF)
MIT: Introduction to Algorithms – Lecture 24: Geometry (PDF)
Wikipedia – Binärer Suchbaum

Point location
Point set triangulation
Planar straight-line graph
Voronoi diagram
Voronoi-Diagramm
Delaunay triangulation
Delaunay-Triangulierung

Woche 1

time complexity

Analysis of Algorithms: Average Case Analysis
Analysis of Algorithms
Analysis of Algorithms | Set 1 (Asymptotic Analysis)
Analysis of Algorithms | Set 2 (Worst, Average and Best Cases)
ec 1 | MIT 6.046J / 18.410J Introduction to Algorithms (SMA 5503), Fall 2005

Time complexity: Best and Worst cases | Quick Sort | GateAppliedcourse
Stochastik Übersicht, Wahrscheinlichkeit, beschreibende/beurteilende Statistik
Kombinatorik, Permutation mit Wiederholung, Beispiel am Wort Wetter | Mathe by Daniel Jung
Kombinatorik, Permutation, Variation, Kombination, Beispiele, Abzählverfahren | Mathe by Daniel Jung

Comparison sorts

Simple sorts

  • Insertion sort
  • Selection sort

Efficient sorts

  • Merge sort
  • Heap sort
  • Quick sort

Bubble sort

  • Bubble sort

Exotic sorts

  • Binary tree sort
  • Cycle sort
  • Library sort
  • Patience sort
  • Smooth sort
  • Strand sort
  • Tournament sort
  • Cocktail sort
  • Comb sort
  • Gnome sort
  • Block sort
  • Odd–even sort
  • Curve sort

Time complexity
Zeitkomplexität
Laufzeit (Informatik)
Sortierverfahren

AVL-Baum/
B-Baum

codeadventurer.de
codeadventurer.de: Die O Notation. Wie schnell ist dein Code?
How to analyse time complexity: Count your steps
Time complexity of recursive functions [Master theorem]
Big O notation: definition and examples
Zeitkomplexität und O-Notation
Analysis of Algorithms
2.3. Big-O Notation
Problem Solving with Algorithms and Data Structures using Python

2d line intersection

Line–line intersection
How do you detect where two line segments intersect? [closed]
Line and Segment Intersections

Aufgabe 1

Line–line intersection

Woche 2

Sweep (Informatik) (Sweep-Line)
Rot-Schwarz-Baum (red–black tree oder RB tree)
Wikipedia: JTS Topology Suite
LocationTech JTS Topology Suite

JavaDoc JTS Topology Suite 1.15.0-SNAPSHOT API
github.io JTS Topology Suite
JTS Frequently Asked Questions

github.com/locationtech/jts, The JTS Topology Suite is a Java library for creating and manipulating vector geometry.
github.com/locationtech/jts/releases
github.com/locationtech/jts/blob/master/MIGRATION.md
github.com/locationtech/jts/blob/master/USING.md
github.com/locationtech/jts/blob/master/DEVELOPING.md

GIS Wiki: Java Topology Suite
OSGeoLive JTS Topology Suite

Wikipedia: Open Source Geospatial Foundation (OSGeo)
OSGeo – The Open Source Geospatial Foundation
OSGeo Libraries (GEOS, JTS Topology Suite)

Aufgabe 1

Array sortieren mit Java
Converting between an Array and a List in Java
A Guide to TreeSet in Java
TreeSet in Java
Binary Search Tree Complete Implementation
Binary Search Tree – Java Implementation

Convex Hull – Divide & Conquer

Convex hull algorithms
Complexity of the QuickHull Algorithm?

Convex Hull Algorithms: Divide and Conquer
Divide and Conquer algorithm to find Convex Hull
Quick Hull Algorithm to find Convex Hull

Quickhull Algorithm for Convex Hull
Convex Hull using Divide and Conquer Algorithm
Tangents between two Convex Polygons

Convex Hull, COMP 215 Lecture 5, PDF
An efficient way of merging two convex hulls

Tangents to & between 2D Polygons

Woche 3

Wikipedia

Planarer Graph
Dreiecksgraph
Eulerscher Polyedersatz
Vollständiger Graph
Grad (Graphentheorie)

Line segment intersection
Bentley–Ottmann algorithm

Schleife (Graphentheorie)
Zyklus (Graphentheorie)

Dreieckszahl
Satz von Kuratowski
Satz von Wagner
Bipartiter Graph

Line Segment Intersection (LSI)

Freie Universität Berlin – Computational Geometry: Line segment intersection
The intersection of two line segments

YouTube

Mathematik (WiSe 2013/2014 und SoSe 2014) (Playlist)
Planare Graphen
Vollständige Graphen

Woche 4

Graph (Graphentheorie)
Nachbarschaft (Graphentheorie)
Isomorphie von Graphen

Kreisgraph

Planar graph
Cycle graph
Star (graph theory)
Wheel graph
Cubic graph
Ladder graph

Category:Planar graphs
Category:Triangulation (geometry)
List of graphs by edges and vertices

Doubly-connected edge list
Half-Edge-Datenstruktur

Wolfram MathWorld

Star Graph
Wheel Graph
Cubical Graph
Platonic Graph
Hypercube Graph
Halved Cube Graph

Graph

Families of Graphs (PDF)

DCEL

Freie Universität Berlin – DCEL: Eine Datenstruktur für ebene Unterteilungen (PDF)
Plane Graphs and the DCEL (PDF)
Computergeometrie (Senior)
Computergeometrie (Senior) (übersetzt!)
Index of /farshi/Teaching/CG3921/Slides
Computing the Overlay of Two Subdivisions
Geometric Algorithms (INFOGA) 2018, Block 2
Computational Geometry – Lecture 2b: Subdivision representation and map overlay
Overlay of Two Subdivisions – PowerPoint PPT Presentation

CGAL

2D Arrangements – Arrangement on Surface

Truncation (geometry)
Archimedean solid
Conway polyhedron notation

YouTube

Sarada Herke

Graph Theory: 04. Families of Graphs
Graph Theory: 07 Adjacency Matrix and Incidence Matrix
Graph Theory: 27. Hamiltonian Graphs and Problem Set
Graph Theory: 57. Planar Graphs
Graph Theory: 61. Characterization of Planar Graphs
Do Maths with Pigeons and Handshakes

Maths Resource

Planar Graphs – Worked Examples

freeCodeCamp.org

Algorithms Course – Graph Theory Tutorial from a Google Engineer (6:44:39) => 6h!

SDMLab

overlay

mycodeschool

Data structures
Graph Representation part 01 – Edge List
Graph Representation part 02 – Adjacency Matrix
Graph Representation part 03 – Adjacency List

Gokul Raghuraman

Planar mesh data structure that uses vertices, half-edges and faces

UC Davis Academics

Subdivision Surfaces Part 1

Woche 5

Eulerscher Polyedersatz

Freie Universität Berlin – Lecture 4 (CGAL)

CGAL

2D Triangulation
github.com/CGAL/cgal/tree/master/Triangulation_2/examples/Triangulation_2

Woche 6

Woche 7

Heap (Datenstruktur)
Min-Max-Heap
Vorrangwarteschlange
Stapelspeicher

14_Algorithmen&Datenstrukturen || Heap (Aufbau & Daten einfügen)
15_Algorithmen&Datenstrukturen || Heap (Daten löschen & Arraydarstellung)
Vorrangwarteschlange
Priority Queue Introduction
2.6.3 Heap – Heap Sort – Heapify – Priority Queues
Fastest Sorting Algorithm. Ever!
AlgoDat – 03: Heaps, Heapify-Funktion und Heapsort mit Beispiel und Code (C#)

Woche 8

Problem
Optimierungsproblem
Suchproblem
Heuristik
Komplexitätsklasse
Liste von Komplexitätsklassen
NP (Komplexitätsklasse)
NP-Schwere, NP-hard
P-NP-Problem
Polynomialzeit
Polynom
Laufzeit (Informatik)
Zeitkomplexität
Landau-Symbole

Single-machine scheduling, Performance measures: Tardiness, Earliness, Lateness Flowtime
Google OR-Tools: Job Shop
Sequencing and Scheduling – Johnson’s Algorithm
Job Sequencing Problem with Deadline, Greedy Algorithm
ICAPS 2015: “Iterated Local Search Heuristics for Minimizing Total Completion Time in …”
Michael Sambol Algorithms
4. Search: Depth-First, Hill Climbing, Beam (Beam Search: 35:15)
Hill Climbing – Bergsteigeralgorithmus Suchalgorithmen
beam search, search wrap up (4:30)
Solution Space Search,Beam Search
What is Beam search in artificial intelligence in hindi | lec 14 | Nauman Malik | CS607 | easy methd
mod10lec83-Beam Search (not exactly)
Beam Search Algorithm (Draft by Andrew Jungwirth)
Representing graphs
Graph and its representations
Graph Representation part 01 – Edge List
Graph representation. set, adjacency matrix and adjacency list
Data Structures using C Part 29 – Adjacency List Representation of Graph in c programming
Meta-Heuristic Optimization Techniques and Its Applications in Robotics

H.W. Lang Hochschule Flensburg

Algorithmen
Asymptotische Komplexität
Obere und untere Schranken

Approximation algorithms – Heuristic Algorithms (PDF)
Wikipedia: Approximation algorithm
Wikipedia: Algorithmus von Christofides
ApproximationAlgorithms
What does the 2 in a 2-approximation algorithm mean?

Algorithmen und Datenstrukturen
Erdős-Zahl
Bacon-Zahl

Interval Partitioning ( Greedy Algorithm ) – Algorithms
Rate Monotonic Scheduling
Sequencing Problem For More than 3 Machines|| Processing n Jobs on m Machines By JOLLY Coaching
Minimum tardiness problem
Scheduling with deadlines: minimizing lateness
Dijkstra’s Algorithm ( incl. Example and Step-By-Step Guide ) – Algorithms
Sequencing n jobs on 1 machine – Example 2
N jobs and 2 machines using Johnson’s algorithm in Hindi ( Lecture.40)
n jobs and 3 machines ( Johnson’s algorithm ) in Hindi ( Lecture.41)

Woche 9

  • Maximum Regret
  • Branch-and-bound
  • Branch-and-cut

Graph traversal
Tree traversal
Search tree

https://github.com/jackspyder/2-opt, Java 2-opt solution for TSP Coursework
2-opt
Lin–Kernighan heuristic, K. Helsgaun (LKH), LK local search

Complexity Zoo
APX
Optimierungsproblem
Kombinatorische Optimierung
Optimierung (Mathematik)
Approximationsalgorithmus
Time complexity – Polynomial time
Polynomial-time approximation scheme
List of NP-complete problems
NP-completeness
Linear programming
Dynamic programming

Knoten mit gegebenen Kanten

Breitensuche, (breadth-first search, BFS)
Tiefensuche, (depth-first search, DFS)
Iterative Tiefensuche, (Iterative Tiefensuche)
Bestensuche, (best-first search)

Knoten ohne Kanten, resp. mit einem vollständigen Graph

Nearest neighbor search
Suchverfahren, Informierte Suche = Heuristik

Woche 10

A Practical Introduction to Simulated Annealing
A Practical Introduction to Genetic Algorithms

Woche 11

github.com/thiagodnf/jacof, Java Ant Colony Optimization Framework
github.com/LazoCoder/Ant-Colony-Optimization-for-the-Traveling-Salesman-Problem, A population based stochastic algorithm for solving the Traveling Salesman Problem
TSP ACO Applet
Ant Colony Optimization Tutorial
github.com/eugenp/tutorials/tree/master/algorithms-genetic

meta-heuristics
Lineare Optimierung, Simplex-Verfahren, Operations Research (Linear Programming)

Quadratic Assignment Problem

Quadratic assignment problem
Quadratic Assignment Problem
Quadratic Assignment on Different Data Models
Yuehaw Khoo — Clique-Based Semidefinite Relaxation of the Quadratic Assignment Problem

Assignment Problem / Branch and Bound

Assignment Problem using Branch and Bound
Assignment problem by branch and bound method
7.3 Traveling Salesman Problem – Branch and Bound

Woche 12

Steinerbaumproblem
Santa’s Stolen Sleigh
Geographische Länge
Geographische Breite
Geographische Koordinaten, Geographische Lage
Gradnetz
Hilbert R-tree
R-Baum, R-tree
Environment for DeveLoping KDD-Applications Supported by Index-Structures (ELKI)
Closest pair of points problem
Dichtestes Punktpaar

Woche 13

github.com/OSUCartography/JMapProjLib, JMapProjLib: Java Map Projection Library
Converting longitude/latitude to X/Y coordinate
Convert latitude/longitude point to a pixels (x,y) on mercator projection
Mercator projection
Mercator-Projektion

C

PROJ – a generic coordinate transformation software
github.com/OSGeo/proj.4, PROJ.4 – Cartographic Projections Library
PROJ.4
Lat/long (Geodetic alias)
Mercator

Java OpenGL

Java OpenGL (JOGL)
Where can I find the package javax.media.opengl?

JavaFX

  • Sphere
  • PhongMaterial
  • RotateTransition
  • PointLight

Position of PerspectiveCamera in JavaFX 8
JAVA PROGRAMMING: ADD, ANIMATE, AND LIGHT UP OBJECTS IN 3D

PHP

github.com/mfeldheim/hermap, Hermap libraries: stuff related to maps

R

Overview of Coordinate Reference Systems (CRS) in R (PDF)
R Spatial – Coordinate Reference Systems
Choosing the correct value for proj4string for shapefile reading in R?

John Levine

John Levine’s Videos

  • CS103: Proof by Induction
  • CS103: Another Direct Proof
  • CS103: Direct Proof
  • CS103: Infinite Sets and Definitions
  • Iterative Deepening
  • Depth First Search
  • Breadth First Search – Part 2
  • Breadth First Search – Part 1
  • A* Search
  • Uniform Cost Search
  • Minimax with Alpha Beta Pruning
  • Monte Carlo Tree Search

Dynamic Programming

What Is Dynamic Programming and How To Use It

Other Metaheuristics

Learn Particle Swarm Optimization (PSO) in 20 minutes
Artificial Bee Colony (ABC) Visualized – Artificial Intelligence
Honey Bee Optimization (HBO) Algorithm
Bat Algorithm BA

HackerRank

Algorithms

  • Recursion
  • Solve ‘Ice Cream Parlor’ Using Binary Search
  • Binary Search
  • Solve ‘Shortest Reach’ Using BFS
  • Solve ‘Connected Cells’ Using DFS
  • Solve ‘Recursive Staircase’ Using Recursion
  • Quicksort
  • Merge Sort
  • Bubble Sort
  • Solve ‘Coin Change’ Using Memoization and DP
  • Memoization and Dynamic Programming
  • Sort An Array with Comparator
  • Bit Manipulation
  • Graph Search, DFS and BFS
  • Solve ‘Lonley Integer’ Using Bit Manipulation

Data Structures

  • Balanced Parentheses in Expression
  • Queue With Two Stacks
  • Stacks and Queues
  • Cycles in a Linked List
  • Linked Lists
  • Binary Search Tree
  • Trees
  • Solve ‘Contacts’ Using Tries
  • Tries
  • Heaps
  • Solve ‘Find the Running Median’ Using Heaps
  • Anagram Problem Solution
  • Hash Tables
  • Solve ‘Ransom Note’ Using Hash Tables

Scheduling / Project Planning / Critical Path

Scheduling projects: How to determine the critical path using activity slack calculations?
Activity slack: Total, safety and free slack definitions
Scheduling, precedence diagramming and the critical path
How to Calculate Critical Path, Float, Early Start & Late Start, and Early Finish & Late Finish
Understanding Critical Path in Project Management (Example Included)
he Ultimate Guide to the Critical Path Method

Netzplan / Kritischer Pfad

Statt Projekte mit Arbeitspaketen nun nur Abhängigkeiten zwischen Tasks in EINEM Job. Etwas anderes Problem Projektplan/Netzplan vs. Scheduling.
Netzplan | Kritischer Pfad | Beispiel | Berechnung | Produktion (2/3) | Einfach sehr gut erklärt!
Kritischer Pfad im Projektablauf

Dell Troubleshooting

Ein Referenzhandbuch für die Diagnoseanzeigen von Dell-OptiPlex

Optiplex 980 2010
Optiplex 790 2011

A reference guide to the Dell OptiPlex Diagnostic Indicators
How to Troubleshoot a No Power Issue on your Dell Desktop

dell optiplex 980 flashing orange light
dell optiplex 980 blinking amber light
problem code 1 & 3
diagnostic lights 1 & 3 flash

Optiplex 960 SFF, problem code 1 & 3, would someone please assist
Dell Optiplex 780 MiniTower, power light flashes amber diagnostic lights 1 & 3 flash

FIX AMBER LIGHT IN DELL OPTIPLEX 980 PC SOLUTION OR OTHER DESKTOP DELL PC
Fix the Dell Orange Light of Death

TSM_EmbReal – HiFive 1

HiFive1 | Crowd Supply
Wikipedia SiFive

HiFive1 | SiFive
Documentation | SiFive
RISC-V Tools | SiFive

SEGGER Adds Support for SiFive’s Coreplex IP to Its Industry Leading J-Link Debug Probe
Open Source RISC – Eclipse with RISC-V on the SiFive HiFive1 Board
PlatformIO RISC-V
RISC-V Foundation | Instruction Set Architecture (ISA)

Tutorials

FE310G: an open source RISC-V microcontroller – Introduction
FE310G: an open source RISC-V microcontroller – Interrupt System
FE310G: an open source RISC-V microcontroller – IDE

Core vs. Hart

Definition of “hart”
Add a definition for hart
RiscV spec references the word ‘hart’ – what does ‘hart’ mean?

Platform

GreenWaves Technologies GAP8: The IoT Application Processor
PULP Platform – Open hardware, the way it should be!

Abbrefiations and Dictionary

ISR Interrupt Service Routine
IST Interrupt Service Table
CSR Control status register
IER Interrupt enable register
ISA Instruction Set Architecture
PLIC Platform-Level Interrupt Controller
CLINT Core Local Interruptor
AON Always-On
WDT Watchdog Timer
RTC Real-Time Clock
PMU Power-Management Unit
OTP One-Time Programmable Memory
GPIO General Purpose Input/Output Controller

git

GitLab: Hans Buchmann
gitlab.fhnw.ch/edu/tsm-embreal

Wikipedia

Befehlssatz, Instruction Set
Befehlssatzarchitektur, Instruction Set Architecture (ISA)

Hardware I/O Functions / Alternate Functions (UART, SPI, PWM)

HiFive-1 Bare Bones
PIO_IOF_SEL in LED Fade Demo
github.com/sifive/freedom-e-sdk/blob/master/bsp/include/sifive/devices/gpio.h
https://github.com/sifive/freedom-e-sdk/blob/master/software/led_fade/led_fade.c
https://github.com/sifive/freedom-e-sdk/blob/master/bsp/env/freedom-e300-arty/platform.h

github.com/RIOT-OS/RIOT/blob/master/cpu/fe310/include/vendor/platform.h

[PATCH 12/15] HiFive1: add UART support
RTEMS BSP for HiFive1
[PreGSoC 2017] Make a port of RTEMS for HiFive1
Utilizing full power of RISC-V architecture via usage of RTEMS on top of SiFive FE310 processors

GPIO_IOF_EN
GPIO_IOF_SEL

vs.

GPIO_OUTPUT_EN
GPIO_OUTPUT_VAL

C++

C++ Standard

Which C++ standard is the default when compiling with g++?
Standard Predefined Macros

$ g++ -dM -E -x c++  /dev/null | grep -F __cplusplus
#define __cplusplus 201402L ==> 2014 C++ standard

C++ Syntax

Private members

class PrivateClass {

    int a;
    int b;

    PrivateClass();
};

PrivateClass::PrivateClass() :
a(0),
b(1)
{
    //
}
#include "PrivateClass.h"

int main()
{
    PrivateClass k;
}
src/main.cpp: In function ‘int main()’:
src/main.cpp: error: ‘PrivateClass::PrivateClass()’
                     is private within this context
     PrivateClass k;

Private Static Instantiation

#include "stdio.h"

class StaticClass {

    static StaticClass k;

    int a;
    int b;

    StaticClass();
};

StaticClass StaticClass::k;

StaticClass::StaticClass() :
a(0),
b(1)
{
    printf("Hurra\n");
}
int main()
{
    //
}
$ ./main
Hurra

final

What is the purpose of the “final” keyword in C++11 for functions?
final specifier (since C++11)
override specifier (since C++11)

class Person final {
   [...]
}

class Andreas : Person {
   [...]
};

// error: cannot derive from ‘final’ base ‘Person’ in derived type ‘Andreas’
class Person {
   virtual void print() final;
}

class Andreas : Person {
   virtual void print() final;
};

// error: virtual function ‘virtual void Andreas::print()’
// overriding final function ‘virtual void Person::print()’

static vs. const

How to initialize private static members in C++?

class ConstClass {

    static int a       = 1;
    static const int b = 2;

    ConstClass();
};

ConstClass::ConstClass()
{
    //
}
int main()
{
    //
}
In file included from src/ConstClass.cpp:2:0:
include/ConstClass.h:6:16: error: ISO C++ forbids in-class
                                  initialization of non-const
                                  static member ‘ConstClass::a’
     static int a       = 1;
class ConstClass {

    static int a;
    static const int b = 2;

    ConstClass();
};

int ConstClass::a = 1;

ConstClass::ConstClass()
{
    //
}

const

Meaning of ‘const’ last in a function declaration of a class?
C++-Programmierung/ Eigene Datentypen definieren/ Methoden

class Person {
    void foo() const;   /* this pointer is const =>
                           cannot change any member data */
}

class A {
    public:
        int a, b, c, d;
};

class B {
    public:
        /* Das übergebene A-Objekt ist innerhalb 
           der Methode konstant */
        void methode(A const& parameter_name);
};

Operator Overload

class Person {
    operator unsigned() const;   /* cast-operator */
}

template

What does template mean?
Template (C++)

Type Parameters

  • Types
  • Templates

Non-type Parameters

  • Pointers
  • References
  • Integral constant expressions

In fact, we can create algorithms which evaluate at compile time (from Wikipedia):

template <int N>
struct Factorial 
{
     enum { value = N * Factorial<N - 1>::value };
};

template <>
struct Factorial<0> 
{
    enum { value = 1 };
};

// Factorial<4>::value == 24
// Factorial<0>::value == 1
void foo()
{
    int x = Factorial<4>::value; // == 24
    int y = Factorial<0>::value; // == 1
}

constexpr

  • A constexpr variable…
  • A constexpr function…
  • A constexpr constructor…

constexpr specifier (since C++11)
Difference between `constexpr` and `const`
When should you use constexpr capability in C++11?

class Person {
    operator unsigned() const;   /* cast-operator */
}

decltype

decltype specifier
decltype
Modern C++ Features – decltype and std::declval
Improved Type Inference in C++11: auto, decltype, and the new function declaration syntax
C equivalent to C++ decltype

namespace sys::pa {
    /* Statt dem statischen Datentyp einfach der Datentyp,
       der in CSR::mstatus benutzt wird.

       decltype “returns” a type. */
    /* 
    decltype(CSR::mstatus) CSR::mstatus;
}

struct A { double x; };
const A* a;

/* type of y is double (declared type) */
decltype(a->x) y;

/* type of z is const double& (lvalue expression) */
decltype((a->x)) z = y;
 
/* return type depends on template parameters.
   return type can be deduced since C++14 */
template<typename T, typename U>
auto add(T t, U u) -> decltype(t + u)
{
    return t+u;
}

RISC-V Assembly

C++ to ASM linkage in GCC

$ cat hardware-register-extern-asm.S | \
  c++filt > hardware-register-extern-asm2.S
int getObjId(void);         => _ZN8getObjIdEv
int getObjId(int);          => _ZN8getObjIdEi
int getObjId(unsigned int); => _ZN8getObjIdEj

'this is a mangled symbol' (_Z).
'It has 8 characters of user-defined symbol relevance' (8),
(v=void, i=int, j=unsigned int...). 
_GLOBAL__sub_I__ZN3App3appE:
	call	_Z41__static_initialization_and_destruction_0ii
	call	__static_initialization_and_destruction_0(int, int)  [demangled]

_Z41__static_initialization_and_destruction_0ii:
__static_initialization_and_destruction_0(int, int):  [demangled]
	call	_ZN3AppC1Ev
	call	App::App()  [demangled]

_ZN3App3appE:
App::app: [demangled]

_ZN3AppC2Ev: (_ZN3AppC1Ev)
App::App():  [demangled]

20400480 <_Z41__static_initialization_and_destruction_0ii>:
2040049e:	374d                	jal	20400440 <_ZN3sys5Msg_1C1Ev>
[...]
204004c0 <_GLOBAL__sub_I__ZN3sys5Msg_13msgE>:
204004cc:	3f55                	jal	20400480 <_Z41__static_initialization_and_destruction_0ii>


20404160 <_Z41__static_initialization_and_destruction_0ii>:
2040417e:	370d                	jal	204040a0 <_ZN3AppC1Ev>
[...]
20404000 <_GLOBAL__sub_I__ZNK3sys3Mod5Entry4showEPFvvE>:
2040400c:	3f55                	jal	20403fc0 <_Z41__static_initialization_and_destruction_0ii>


20403fc0 <_Z41__static_initialization_and_destruction_0ii>:
20403fde:	2089                	jal	20404020 <_ZN3sys7BuildIDC1Ev>
[...]
204041a0 <_GLOBAL__sub_I__ZN3App3appE>:
204041ac:	3f55                	jal	20404160 <_Z41__static_initialization_and_destruction_0ii>

Extern vs. Pointer

204040a0:       1101                    addi    sp,sp,-32
204040a2:       ce06                    sw      ra,28(sp)
204040a4:       c62a                    sw      a0,12(sp)
204040a6:       100127b7                lui     a5,0x10012
204040aa:       00078793                mv      a5,a5
204040ae:       4798                    lw      a4,8(a5)
204040b0:       004007b7                lui     a5,0x400
204040b4:       8f5d                    or      a4,a4,a5
204040b6:       100127b7                lui     a5,0x10012
204040ba:       00078793                mv      a5,a5
204040be:       c798                    sw      a4,8(a5)
204040c0:       100127b7                lui     a5,0x10012
204040c4:       00078793                mv      a5,a5
204040c8:       47d8                    lw      a4,12(a5)
204040ca:       004007b7                lui     a5,0x400
204040ce:       8f5d                    or      a4,a4,a5
204040d0:       100127b7                lui     a5,0x10012
204040d4:       00078793                mv      a5,a5
204040d8:       c7d8                    sw      a4,12(a5)
204040da:       204047b7                lui     a5,0x20404

App::App():
.LFB108:
        addi    sp,sp,-32
        sw      ra,28(sp)
        sw      a0,12(sp)
.LBB2:
        
        lui     a5,%hi(GPIO)
        addi    a5,a5,%lo(GPIO)
        lw      a4,8(a5)
        
        li      a5,4194304
        or      a4,a4,a5
        
        lui     a5,%hi(GPIO)
        addi    a5,a5,%lo(GPIO)
        sw      a4,8(a5)
        
        lui     a5,%hi(GPIO)
        addi    a5,a5,%lo(GPIO)
        lw      a4,12(a5)
        
        li      a5,4194304
        or      a4,a4,a5
        
        lui     a5,%hi(GPIO)
        addi    a5,a5,%lo(GPIO)
        sw      a4,12(a5)
204040a0:       7179                    addi    sp,sp,-48
204040a2:       d606                    sw      ra,44(sp)
204040a4:       d422                    sw      s0,40(sp)
204040a6:       c62a                    sw      a0,12(sp)
204040a8:       100127b7                lui     a5,0x10012
204040ac:       cc3e                    sw      a5,24(sp)
204040ae:       47e2                    lw      a5,24(sp)
204040b0:       4798                    lw      a4,8(a5)
204040b2:       004007b7                lui     a5,0x400
204040b6:       8f5d                    or      a4,a4,a5
204040b8:       47e2                    lw      a5,24(sp)
204040ba:       c798                    sw      a4,8(a5)
204040bc:       47e2                    lw      a5,24(sp)
204040be:       43d8                    lw      a4,4(a5)
204040c0:       001007b7                lui     a5,0x100
204040c4:       8f5d                    or      a4,a4,a5
204040c6:       47e2                    lw      a5,24(sp)
204040c8:       c3d8                    sw      a4,4(a5)
204040ca:       47e2                    lw      a5,24(sp)
204040cc:       47d8                    lw      a4,12(a5)
204040ce:       004007b7                lui     a5,0x400
204040d2:       8f5d                    or      a4,a4,a5
204040d4:       47e2                    lw      a5,24(sp)
204040d6:       c7d8                    sw      a4,12(a5)
204040d8:       204057b7                lui     a5,0x20405

App::App():
.LFB108:
        addi    sp,sp,-48
        sw      ra,44(sp)
        sw      s0,40(sp)
        sw      a0,12(sp)
.LBB4:
.LBB5:
        
        li      a5,268509184
        sw      a5,24(sp)
        
        lw      a5,24(sp)
        lw      a4,8(a5)
        
        li      a5,4194304
        or      a4,a4,a5
        
        lw      a5,24(sp)
        sw      a4,8(a5)
        
        lw      a5,24(sp)
        lw      a4,4(a5)
        
        li      a5,1048576
        or      a4,a4,a5
        
        lw      a5,24(sp)
        sw      a4,4(a5)
        
        lw      a5,24(sp)
        lw      a4,12(a5)
        
        li      a5,4194304
        or      a4,a4,a5
        
        lw      a5,24(sp)
        sw      a4,12(a5)

C++ Optimizing

Optimizing software in C++ – An optimization guide for Windows, Linux and Mac platforms (2018)

x86-64

x86-Prozessor
x64
x86 calling conventions
x86 assembly language
Assembler-Programmierung für x86-Prozessoren
Limitations of Intel Assembly Syntax Compared to AT&T, GNU tools and how to use AT&T / Intel Syntax
X86 Assembly/GAS Syntax
x86 Assembly Guide
x86-64 Assembly Programming
What is the difference between MOV and LEA?
Baby steps in x86 assembly

Calling Convention

Introduction to X86-64 Assembly for Compiler Writers, 2015
System V ABI (PDF)
System V ABI
Wikipedia: x86 calling conventions
Assembly registers in 64-bit architecture
Passing argument through registers instead of the stack

Books

Guide to Assembly Language Programming in Linux, Teil 1, Sivarama P. Dandamudi

0xax.github.io

Just a memo – My posts about Linux kernel and low-level stuff
Say hello to x86_64 Assembly [part 1]
Say hello to x86_64 Assembly [part 2]
Say hello to x86_64 Assembly [part 3]
Say hello to x86_64 Assembly [part 4]
Say hello to x86_64 Assembly [part 5]
Say hello to x86_64 Assembly [part 6]
Say hello to x86_64 Assembly [part 7]
Say hello to x86_64 Assembly [part 8]

gcc / g++

-o file     Place output in file file. This applies to whatever sort of output
            is being produced, whether it be an executable file, an object file,
            an assembler file or preprocessed C code. 
-c          Compile or assemble the source files, but do not link. The linking
            stage simply is not done. The ultimate output is in the form of an
            object file for each source file. 
-S          Stop after the stage of compilation proper; do not assemble. The
            output is in the form of an assembler code file for each non-assembler
            input file specified.
-E          Stop after the preprocessing stage; do not run the compiler proper.
            The output is in the form of preprocessed source code, which is sent
            to the standard output. 
-O0         Reduce compilation time and make debugging produce the expected results.
            This is the default.
-O1         Optimize. Optimizing compilation takes somewhat more time, and a lot
            more memory for a large function. 
-O2         Optimize even more. GCC performs nearly all supported optimizations
            that do not involve a space-speed tradeoff. 

gdb

GDB QUICK REFERENCE (PDF)
Using gdb layout when debugging Assembly Language Programs

set disassembly-flavor command
TUI-specific Commands

$ gdb swap
(gdb) b main
(gdb) r

(gdb) set print asm-demangle on

### Disassembly Format
(gdb) set disassembly-flavor att
(gdb) set disassembly-flavor intel
(gdb) show disassembly-flavor

### TUI Commands
(gdb) tui enable
(gdb) tui disable
(gdb) layout asm
(gdb) layout src
(gdb) layout split
(gdb) layout regs
(gdb) focus asm
(gdb) focus src
(gdb) focus regs
(gdb) refresh
(gdb) update

### Assembly
(gdb) ni   (next ASM)
(gdb) si   (step into ASM)

### Sow Registers
(gdb) info reg rdi
rdi            0x7fffffffddb0   140737488346544
(gdb) info reg rdi
rsi            0x7fffffffddb4   140737488346548

### Examine
(gdb) x 0x7fffffffddb0
0x7fffffffddb0: 0x00000001
(gdb) x 0x7fffffffddb4
0x7fffffffddb4: 0x00000002
(gdb) x $rdi
0x7fffffffddb0: 0x00000001
(gdb) x/i $pc  <== Program Counter
=> 0x5555555546ab <swap+1>:     mov    %rsp,%rbp
(gdb) x/i $rip <== Instruction Pointer
=> 0x5555555546ab <swap+1>:     mov    %rsp,%rbp

x command, Displays the memory contents at a given address
print command, Prints the value of a given expression
10.6 Examining Memory
Difference between x and p in gdb?
Program Variables
Examining the Symbol Table
Wikipedia: Symbol Table
Wikipedia: .bss
Wikipedia: Datensegment

x <address>       shows the contents of a memory address

p <symbol>        shows the value stored in a named variable
print <symbol>

info registers    shows registers and what they're doing
info frame

### For example:
int x;
int& f(int& variable) { return variable; }
int  g(int wert)      { return wert; }

(gdb) p x
$3 = 3

(gdb) x x
0x3:    Cannot access memory at address 0x3

(gdb) x &x
0x555555756134 <x>:     0x0000000000000003

(gdb) p r
No symbol "r" in current context.

(gdb) info address x
Symbol "x" is static storage at address 0x555555756134.

(gdb) info symbol 0x555555756134 
x in section .bss of /home/andreas/src/cpp-test/obj/lvalue/lvalue
              --> Symbol Table

(gdb) whatis x
type = int

 Address               Data
 _____________________ ______________________
|          x          |                      |
|    0x555555756134   |               0x3    |
|_____________________|______________________|
|                     |                      |
|        0x3          | Cannot access memory |
|_____________________|______________________|

(gdb) whatis f
type = int &(int &)

(gdb) whatis g
type = int (int)

Stack

how can one see content of stack with gdb

p $sp           shows the stack-pointer address
x $sp           shows the stack-pointer content
0x7fffffffdcd0: 0x0000007900000000

info frame      show the stack frame info
x/4xg $sp       

(gdb) p $sp
$6 = (void *) 0x7fffffffdcd0

(gdb) x $sp
0x7fffffffdcd0: 0x0000007900000000

 Address / Register    Data
 _____________________ _____________________
|                     |                     |
|  Stack Pointer (SP) |    0x7fffffffdcd0   |
|_____________________|_____________________|
|                     |                     |
|        ...          |        ...          |
|_____________________|_____________________|
|                     |                     |
|    0x7fffffffdcd0   |    0x007900000000   |
|_____________________|_____________________|

Attach Source
How to point GDB to your sources
info source command, Dislays information about the current source file

Reading symbols from hardware-register-extern...(no debugging symbols found)...done.
==> no debugging symbols!

(gdb) info sources
No symbol table is loaded.  Use the "file" command.
Before:
CFLAGS=  -O2 -std=c++14 \
After:
CFLAGS=  -O0 -ggdb -std=c++14 \
(gdb) show dir
Source directories searched: $cdir:$cwd

(gdb) dir ../namespace
Source directories searched: /home/andreas/src/tsm-embreal/HiFive1/work/../namespace:$cdir:$cwd

(gdb) info source
Current source file is <unknown>
Compilation directory is /home/andreas/src/tsm-embreal/HiFive1/work
Source language is c++.
Producer is GNU C++14 8.2.0 -march=rv32imac -mabi=ilp32 -ggdb -O0 -std=c++14 -fomit-frame-pointer -fpermissive -fcheck-new -fsized-deallocation -fno-exceptions -fno-use-cxa-atexit -fno-builtin -falign-functions=32 -fno-rtti -fno-unwind-tables.
Compiled with DWARF 2 debugging format.
Does not include preprocessor macro info.

(gdb) list
1	<unknown>: No such file or directory.

(gdb) file ../namespace/hardware-register-extern.cc
"/home/andreas/src/tsm-embreal/HiFive1/work/../namespace/hardware-register-extern.cc": not in executable format: File format not recognized

(gdb) source ../namespace/hardware-register-extern.cc 
../namespace/hardware-register-extern.cc:1: Error in sourced command file:
Undefined command: "".  Try "help".

(gdb) help source
Read commands from a file named FILE.

Eclipse

Eclipse TM Terminal: ESP32 serial terminal
Terminal view not processing \n, \r correctly for serial connection

OpenOCD

OpenOCD – udev rules
GNU MCU Eclipse: How to install the OpenOCD binaries?

Error: libusb_open() failed with LIBUSB_ERROR_ACCESS
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6010, description 'Dual RS232-HS', serial '*' at bus location '*'

$ groups $USER
andreas : andreas adm cdrom sudo dip lpadmin sambashare

$ sudo usermod -aG plugdev $USER
$ sudo usermod -aG dialout $USER

$ groups $USER
andreas : andreas adm dialout cdrom sudo dip plugdev lpadmin sambashare
                      *******                *******
$ sudo xed /etc/udev/rules.d/98-openocd.rules
SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="664", GROUP="plugdev"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="664", GROUP="plugdev"

$ sudo udevadm control --reload-rules

$ udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB1)

  looking at device '/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.1/ttyUSB1/tty/ttyUSB1':
    KERNEL=="ttyUSB1"
    SUBSYSTEM=="tty"
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.1/ttyUSB1':
    KERNELS=="ttyUSB1"
    SUBSYSTEMS=="usb-serial"
    DRIVERS=="ftdi_sio"
    [...]

  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.1':
    KERNELS=="1-2:1.1"
    SUBSYSTEMS=="usb"
    DRIVERS=="ftdi_sio"
    [...]
    ATTRS{interface}=="Dual RS232-HS"
    [...]

  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-2':
    KERNELS=="1-2"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    [...]
    ATTRS{idProduct}=="6010"
    ATTRS{idVendor}=="0403"
    [...]

RIOT

RIOT – The friendly Operating System for the Internet of Things
SiFive HiFive1 RISC-V board
RIOT Wiki: Board%3A-HiFive1 (deprecated)
Creating your first RIOT project
RIOT Wiki: OpenOCD
“Copy this file to your udev configuration directory make sure your vid and pid are covered and adjust the GROUP to some group you are part of.”
RIOT Tutorials for RIOT
RIOT RTOS Port for HiFive1

[  771.168432] usb 1-2: new high-speed USB device number 8 using xhci_hcd
[  771.316930] usb 1-2: New USB device found, idVendor=0403, idProduct=6010
[  771.316935] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  771.316940] usb 1-2: Product: Dual RS232-HS
[  771.316944] usb 1-2: Manufacturer: FTDI
[  771.339667] usbcore: registered new interface driver usbserial_generic
[  771.339683] usbserial: USB Serial support registered for generic
[  771.342827] usbcore: registered new interface driver ftdi_sio
[  771.342844] usbserial: USB Serial support registered for FTDI USB Serial Device
[  771.342934] ftdi_sio 1-2:1.0: FTDI USB Serial Device converter detected
[  771.342974] usb 1-2: Detected FT2232H
[  771.343481] usb 1-2: FTDI USB Serial Device converter now attached to ttyUSB0
[  771.343628] ftdi_sio 1-2:1.1: FTDI USB Serial Device converter detected
[  771.343660] usb 1-2: Detected FT2232H
[  771.343801] usb 1-2: FTDI USB Serial Device converter now attached to ttyUSB1
$ sudo apt-get install libmpfr6
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libmpfr6 is already the newest version (4.0.1-1).
The following packages were automatically installed and are no longer required:
  linux-headers-4.15.0-32 linux-headers-4.15.0-32-generic linux-image-4.15.0-32-generic linux-modules-4.15.0-32-generic linux-modules-extra-4.15.0-32-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

$ dpkg-query -L libmpfr6
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libmpfr.so.6.0.1
/usr/share
/usr/share/doc
/usr/share/doc/libmpfr6
/usr/share/doc/libmpfr6/AUTHORS
/usr/share/doc/libmpfr6/BUGS
/usr/share/doc/libmpfr6/NEWS.gz
/usr/share/doc/libmpfr6/README
/usr/share/doc/libmpfr6/TODO.gz
/usr/share/doc/libmpfr6/changelog.Debian.gz
/usr/share/doc/libmpfr6/copyright
/usr/lib/x86_64-linux-gnu/libmpfr.so.6

$ locate libmpfr
/usr/lib/x86_64-linux-gnu/libmpfr.so.6
/usr/lib/x86_64-linux-gnu/libmpfr.so.6.0.1
/usr/share/doc/libmpfr6
/usr/share/doc/libmpfr6/AUTHORS
/usr/share/doc/libmpfr6/BUGS
/usr/share/doc/libmpfr6/NEWS.gz
/usr/share/doc/libmpfr6/README
/usr/share/doc/libmpfr6/TODO.gz
/usr/share/doc/libmpfr6/changelog.Debian.gz
/usr/share/doc/libmpfr6/copyright
/var/lib/dpkg/info/libmpfr6:amd64.list
/var/lib/dpkg/info/libmpfr6:amd64.md5sums
/var/lib/dpkg/info/libmpfr6:amd64.shlibs
/var/lib/dpkg/info/libmpfr6:amd64.symbols
/var/lib/dpkg/info/libmpfr6:amd64.triggers
$ ../tools/flash.sh startup-1
make: 'startup-1' is up to date.
Open On-Chip Debugger 0.10.0+dev-00062-g5d9f4864-dirty (2018-08-15-11:40)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
adapter speed: 10000 kHz
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Error: libusb_open() failed with LIBUSB_ERROR_ACCESS
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6010, description 'Dual RS232-HS', serial '*' at bus location '*'

Warn : Flash driver of onboard_spi_flash does not support free_driver_priv()

$ cat /etc/udev/rules.d/98-openocd.rules 
ACTION!="add|change", GOTO="openocd_rules_end"
SUBSYSTEM!="usb|tty|hidraw", GOTO="openocd_rules_end"

#Please keep this list sorted by VID:PID

#CMSIS-DAP compatible adapters
ATTRS{product}=="*CMSIS-DAP*", MODE="666", GROUP="root"

LABEL="openocd_rules_end"


$ sudo ../tools/flash.sh startup-1
[sudo] password for andreas: 
../tools/flash.sh: 6: ../tools/flash.sh: [[: not found
make: 'startup-1' is up to date.
Open On-Chip Debugger 0.10.0+dev-00062-g5d9f4864-dirty (2018-08-15-11:40)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
adapter speed: 10000 kHz
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 10000 kHz
Info : JTAG tap: riscv.cpu tap/device found: 0x10e31913 (mfg: 0x489 (SiFive, Inc.), part: 0x0e31, ver: 0x1)
Info : Examined RISCV core; XLEN=32, misa=0x40001105
Info : Listening on port 3333 for gdb connections
Info : [0] Found 2 triggers
halted at 0x204003b4 due to debug interrupt
Info : Found flash device 'issi is25lp128' (ID 0x0018609d)
cleared protection for sectors 64 through 255 on flash bank 0
Info : JTAG tap: riscv.cpu tap/device found: 0x10e31913 (mfg: 0x489 (SiFive, Inc.), part: 0x0e31, ver: 0x1)
halted at 0x204003b4 due to debug interrupt
** Programming Started **
auto erase enabled
Info : Retrying memory read starting from 0x80000000 with more delays
Info : Retrying memory read starting from 0x80000000 with more delays
halted at 0x80000004 due to software breakpoint
halted at 0x80000004 due to software breakpoint
halted at 0x80000004 due to software breakpoint
halted at 0x80000004 due to software breakpoint
halted at 0x80000004 due to software breakpoint
halted at 0x80000004 due to software breakpoint
halted at 0x80000004 due to software breakpoint
halted at 0x80000004 due to software breakpoint
halted at 0x80000004 due to software breakpoint
halted at 0x80000004 due to software breakpoint
wrote 65536 bytes from file startup-1.bin in 0.875611s (73.092 KiB/s)
** Programming Finished **
** Verify Started **
Info : Retrying memory read starting from 0x20400000 with more delays
Info : Retrying memory read starting from 0x20400000 with more delays
Info : Retrying memory read starting from 0x20400000 with more delays
Info : Retrying memory read starting from 0x20400000 with more delays
Info : Retrying memory read starting from 0x20400000 with more delays
Info : Retrying memory read starting from 0x20400000 with more delays
Info : Retrying memory read starting from 0x20400000 with more delays
Info : Retrying memory read starting from 0x20400000 with more delays
Info : Retrying memory read starting from 0x20400000 with more delays
Info : Retrying memory read starting from 0x20400000 with more delays
Info : Retrying memory read starting from 0x20400000 with more delays
Info : Retrying memory read starting from 0x20400000 with more delays
Info : Retrying memory read starting from 0x20400000 with more delays
Info : Retrying memory read starting from 0x20400000 with more delays
Info : Retrying memory read starting from 0x20400000 with more delays
Info : Retrying memory read starting from 0x20400000 with more delays
Info : Retrying memory read starting from 0x20400000 with more delays
Info : Retrying memory read starting from 0x20400000 with more delays
Info : Retrying memory read starting from 0x20400000 with more delays
Info : Retrying memory read starting from 0x20400000 with more delays
verified 13256 bytes in 0.372329s (34.768 KiB/s)
** Verified OK **
halted at 0x20400004 due to step
Warn : Flash driver of onboard_spi_flash does not support free_driver_priv()

hello

---------------------------------------- ctor
0x20402d00	1	sys/sys.o
0x20400320	0	sys/msg-1.o
0x20402e40	2	startup-1.o

test::Startup::Startup()
GNU:c2b75a723e41aa655b4fbbceabe9df508d33e39d
press key 's' ...

good bye
---------------------------------------- dtor
0x20402e60	0	startup-1.o
test::Startup::~Startup()
$ make app-anatomy-1
../tc/bin/riscv32-fhnw-elf-g++ -O2 -std=c++14 -march=rv32imac -mabi=ilp32 -fomit-frame-pointer -fpermissive -fcheck-new -fsized-deallocation -fno-exceptions -fno-use-cxa-atexit -fno-builtin -falign-functions=32 -Wreturn-type -fno-rtti -Wall -fno-unwind-tables  -include "sys/sys.h" -I /home/andreas/src/tsm-embreal/HiFive1/namespace -I /home/andreas/src/tsm-embreal/src -DEARLY_INIT -DNO_FLOATS -DNO_LONG_DIV -DSYS_SYS_SHOW_STARTUP -D'INTERFACE(name,info)=' -D'IMPLEMENTATION(name,info)=' -D'VERSION="heads/master-0-g361662c "'    /home/andreas/src/tsm-embreal/HiFive1/namespace/app-anatomy-1.cc   -o app-anatomy-1
/home/andreas/src/tsm-embreal/resources/gcc-riscv-8.2.0/bin/../lib/gcc/riscv32-fhnw-elf/8.2.0/../../../../riscv32-fhnw-elf/bin/ld: cannot find crt0.o: No such file or directory
/home/andreas/src/tsm-embreal/resources/gcc-riscv-8.2.0/bin/../lib/gcc/riscv32-fhnw-elf/8.2.0/../../../../riscv32-fhnw-elf/bin/ld: cannot find -lstdc++
/home/andreas/src/tsm-embreal/resources/gcc-riscv-8.2.0/bin/../lib/gcc/riscv32-fhnw-elf/8.2.0/../../../../riscv32-fhnw-elf/bin/ld: cannot find -lm
/home/andreas/src/tsm-embreal/resources/gcc-riscv-8.2.0/bin/../lib/gcc/riscv32-fhnw-elf/8.2.0/../../../../riscv32-fhnw-elf/bin/ld: cannot find -lc
/home/andreas/src/tsm-embreal/resources/gcc-riscv-8.2.0/bin/../lib/gcc/riscv32-fhnw-elf/8.2.0/../../../../riscv32-fhnw-elf/bin/ld: cannot find -lgloss
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'app-anatomy-1' failed
make: *** [app-anatomy-1] Error 1


$ make clean
rm -f sys/deb/deblow.o sys/boot/big-bang-continued.o sys/msg-1.o sys/board.o sys/abi/abi.o startup-1.o sys/boot/big-bang.o sys/reg/aon.o io/ascii/out.o sys/msg.o math/double.o sys/reg/uart.o sys/reg/gpio.o io/ascii/write.o sys/sys.o sys/deb/deblow0.o util/float-conv.o sys/deb/deb.o sys/hwreg.o startup-1 \
        startup-1.map \
        startup-1.bin \
        tor.o

$ make makefile
/home/andreas/src/tsm-embreal/tools/makefile.sh ../config/projects.xml > Makefile

$ make app-anatomy-1
[...]
k$ make cpu-demo
g++ -O2 -std=c++14 -c -ocpu-demo.o /home/andreas/src/tsm-embreal/posix/src/cpu-demo.S
g++   cpu-demo.o  -lm -lpthread -lasound -o cpu-demo
/usr/bin/x86_64-linux-gnu-ld: cannot find -lasound
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'cpu-demo' failed
make: *** [cpu-demo] Error 1

$ git pull
$ make makefile
../../tools/makefile.sh ../config/projects.xml > Makefile

$ make cpu-demo
g++   cpu-demo.o  -lm -lpthread  -o cpu-demo
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'cpu-demo' failed
make: *** [cpu-demo] Error 1

$ make cpu-demo-app
g++ -O2 -std=c++14 -I /home/andreas/src/tsm-embreal/posix/src -I /home/andreas/src/tsm-embreal/src  -c -o cpu-demo-app.o /home/andreas/src/tsm-embreal/posix/src/cpu-demo-app.cc
g++ -O2 -std=c++14 -c -ocpu-demo.o /home/andreas/src/tsm-embreal/posix/src/cpu-demo.S
g++  cpu-demo-app.o cpu-demo.o  -lm -lpthread  -ocpu-demo-app
$ make event-demo-1
../tc/bin/riscv32-fhnw-elf-g++
-O2
-std=c++14
-march=rv32imac
-mabi=ilp32
-fomit-frame-pointer
-fpermissive
-fcheck-new
-fsized-deallocation
-fno-exceptions
-fno-use-cxa-atexit
-fno-builtin
-falign-functions=32
-Wreturn-type
-fno-rtti
-Wall
-fno-unwind-tables
-include "sys/sys.h"
-I tsm-embreal/HiFive1/namespace
-I tsm-embreal/src
-DEARLY_INIT
-DNO_FLOATS
-DNO_LONG_DIV
-DSYS_SYS_SHOW_STARTUP
-D'INTERFACE(name,info)='
-D'IMPLEMENTATION(name,info)='
-D'VERSION="heads/master-0-g0f5b43b-dirty "'
-c
-o sys/deb/deblow.o
tsm-embreal/HiFive1/namespace/sys/deb/deblow.cc

tsm-embreal/HiFive1/namespace/sys/deb/deblow0.S
tsm-embreal/HiFive1/namespace/sys/boot/big-bang.S
tsm-embreal/HiFive1/namespace/sys/msg-1.cc
tsm-embreal/HiFive1/namespace/sys/msg.cc
tsm-embreal/HiFive1/namespace/io/ascii/out.cc
tsm-embreal/HiFive1/namespace/io/ascii/write.cc
tsm-embreal/HiFive1/namespace/util/float-conv.cc
tsm-embreal/HiFive1/namespace/math/double.cc
tsm-embreal/HiFive1/namespace/sys/deb/deb.cc
tsm-embreal/HiFive1/namespace/sys/abi/abi.cc
tsm-embreal/HiFive1/namespace/sys/board.cc
tsm-embreal/HiFive1/namespace/sys/reg/gpio.cc
tsm-embreal/HiFive1/namespace/sys/boot/big-bang-continued.cc
tsm-embreal/HiFive1/namespace/sys/reg/uart.cc
tsm-embreal/HiFive1/namespace/sys/reg/aon.cc
tsm-embreal/HiFive1/namespace/sys/hwreg.cc
tsm-embreal/HiFive1/namespace/sys/sys.cc
tsm-embreal/HiFive1/namespace/event-demo-1.cc
tsm-embreal/HiFive1/namespace/sys/event.cc

../tc/bin/riscv32-fhnw-elf-objdump
-wt 
sys/deb/deblow.o
sys/deb/deblow0.o
sys/boot/big-bang.o
sys/msg-1.o
sys/msg.o
io/ascii/out.o
io/ascii/write.o
util/float-conv.o
math/double.o
sys/deb/deb.o
sys/abi/abi.o
sys/board.o
sys/reg/gpio.o
sys/boot/big-bang-continued.o
sys/reg/uart.o
sys/reg/aon.o
sys/hwreg.o
sys/sys.o
event-demo-1.o
sys/event.o
|
tsm-embreal/tools/mod-dep.py -c tor -
|
../tc/bin/riscv32-fhnw-elf-g++
-include "sys/sys.h"
-I tsm-embreal/HiFive1/namespace
-I tsm-embreal/src
-DEARLY_INIT
-DNO_FLOATS
-DNO_LONG_DIV
-DSYS_SYS_SHOW_STARTUP
-D'INTERFACE(name,info)='
-D'IMPLEMENTATION(name,info)='
-D'VERSION="heads/master-0-g0f5b43b-dirty "' 
-O2
-std=c++14
-march=rv32imac
-mabi=ilp32
-fomit-frame-pointer
-fpermissive
-fcheck-new
-fsized-deallocation
-fno-exceptions
-fno-use-cxa-atexit
-fno-builtin
-falign-functions=32
-Wreturn-type
-fno-rtti
-Wall
-fno-unwind-tables 
-c
-x c++
-o tor.o -

&&
../tc/bin/riscv32-fhnw-elf-ld
--relax
-o event-demo-1
tor.o
sys/deb/deblow.o
sys/deb/deblow0.o
sys/boot/big-bang.o
sys/msg-1.o
sys/msg.o 
io/ascii/out.o
io/ascii/write.o
util/float-conv.o
math/double.o
sys/deb/deb.o
sys/abi/abi.o
sys/board.o
sys/reg/gpio.o
sys/boot/big-bang-continued.o
sys/reg/uart.o
sys/reg/aon.o
sys/hwreg.o
sys/sys.o
event-demo-1.o
sys/event.o
-Map=event-demo-1.map
--build-id
-Ltsm-embreal/resources/gcc-riscv-8.2.0/bin/../lib/gcc/riscv32-fhnw-elf/8.2.0/
-lgcc
--script=../config/layout.ld
&&
../tc/bin/riscv32-fhnw-elf-objcopy
--output-target=binary
event-demo-1 
event-demo-1.bin
$ ../tc/bin/riscv32-fhnw-elf-readelf -h event-demo-1
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           RISC-V
  Version:                           0x1
  Entry point address:               0x20400000
  Start of program headers:          52 (bytes into file)
  Start of section headers:          30672 (bytes into file)
  Flags:                             0x1, RVC, soft-float ABI
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         2
  Size of section headers:           40 (bytes)
  Number of section headers:         9
  Section header string table index: 8
  
$ ../tc/bin/riscv32-fhnw-elf-readelf -S event-demo-1
There are 9 section headers, starting at offset 0x77d0:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        20400000 001000 00363c 00  AX  0   0 32
  [ 2] .data             PROGBITS        80000000 005000 000000 00  WA  0   0  1
  [ 3] .sdata            PROGBITS        80000000 005000 000004 00  WA  0   0  4
  [ 4] .bss              NOBITS          80000004 005004 0000a8 00  WA  0   0  4
  [ 5] .comment          PROGBITS        00000000 005004 000011 01  MS  0   0  1
  [ 6] .symtab           SYMTAB          00000000 005018 000ff0 10      7  48  4
  [ 7] .strtab           STRTAB          00000000 006008 00178c 00      0   0  1
  [ 8] .shstrtab         STRTAB          00000000 007794 00003c 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  p (processor specific)

Lumineszenz vs. Wärmestrahlung / Photon / Radiometrie vs. Photometrie

Photometrie
vs.
Radiometrie

Strahlungsheizung
Infrarotstrahlung
Infrarotstrahler, Rotlichtlampe

Fluoreszenz
Lumineszenz, absorbierten Energie in einen angeregten Zustand versetzt und emittiert Licht
vs.
Wärmestrahlung
Wärme, Q
Wärmestrom, Q-Punkt

Feld (Physik), eine Funktion, die jedem Punkt im Raum eine physikalische Größe zuordnet
Skalarfeld
Vektorfeld

Eine kompakte Fläche wird auch geschlossen genannt, wenn betont werden soll, dass es sich um eine Fläche ohne Rand handelt.
Durch eine geschlossene Fläche fließt so viel Strahlungsleistung, wie die eingeschlossenen Quellen abgeben, falls im eingeschlossenen Raum keine Energie durch Absorption verloren geht.

Strömungsfeld => Strömungsgeschwindigkeit
elektrische Feld => Feldstärke
Wärmeleitungsfeld => Wärmestromdichte
Strahlungsfeld => Strahlungsstromdichte, Intensität

Lichtquelle, Thermische Strahler vs. Nichtthermische Strahler

Photon
Intensität (Physik)
Strahlungsenergie, Q
Strahlungsleistung / Strahlungsfluss, Q-Punkt
Strahlungsintensität
Wenn das Medium dämpft (absorbiert), verliert die Welle Energie, welche beispielsweise in Wärmeenergie umgewandelt wird.
Mit zunehmender Ausbreitung der Welle im Medium nimmt also deren Intensität exponentiell ab. Der Absorptionskoeffizient μ {\displaystyle \mu } \mu beschreibt dabei die Materialeigenschaften des durchquerten Mediums.

Photomultiplier
Avalanche-Photodiode

Linienspektrum

Schwarzer Körper
Emissionsgrad
Absorptionsgrad
Absorptionskoeffizient

Plancksches Strahlungsgesetz
Stefan-Boltzmann-Gesetz
Rayleigh-Jeans-Gesetz
Wiensches Strahlungsgesetz
Wiensches Verschiebungsgesetz
Kirchhoffsches Strahlungsgesetz
Lambert-Beer’sches Gesetz, Abschwächung der Intensität einer Strahlung

Java OpenCV and Tesseract ORC

OpenCV
Tesseract (Software)

Image preprocessing with OpenCV before doing character recognition (tesseract)
Java OpenCV + Tesseract OCR “code” regocnition
Optical Character Recognition (OCR) in Java; my current summary of situation – please comment

github.com/aperrau/DetectText, Detect text with stroke width transform
github.com/tleyden/DetectText, Detect text with stroke width transform

PDF Remove Password / Security / Restrictions / DRM (Adobe Digital Editions)

Remove Restrictions

$ qpdf --decrypt in.pdf out.pdf

How to Remove a Password from a PDF File in Linux
Removing PDF usage restrictions
How to remove security from a PDF file?
How to remove the password from a PDF?

Crack Password

$ sudo apt-get install pdfcrack
$ pdfcrack -f pdf-encrypted.pdf
$ qpdf --decrypt --password=DAS_PASSWORT
#!/usr/bin/env bash

rm -rf out/*

find . -maxdepth 1 -iname "*.pdf" | sed "s|^\./||" | while read f
do
    qpdf --decrypt $f out/$f
done

PDF Passwort knacken/herausfinden

Adobe Digital Editions (ADE) v1.7.1
Adobe Digital Editions (ADE) v2.0.1
How to Remove DRM from ePUB & PDF on Adobe Digital Editions ? (not proofed)
3 methods for removing DRM from ePUB on Adobe Digital Editions
github.com/apprenticeharper/DeDRM_tools, DeDRM tools for ebooks
Apprentice Alf’s Blog, Everything you ever wanted to know about DRM and ebooks, but were afraid to ask