new post josh-cvx-2.2, update josh-cvx-2.1, new draft zynq-debug-fsbl
This commit is contained in:
@@ -0,0 +1,36 @@
|
|||||||
|
---
|
||||||
|
title: Zynq 系列 SoC / MPSoC 创建可调试的 FSBL
|
||||||
|
mathjax: true
|
||||||
|
comments: true
|
||||||
|
copyright: true
|
||||||
|
toc:
|
||||||
|
enable: true
|
||||||
|
number: true
|
||||||
|
wrap: true
|
||||||
|
expand_all: true
|
||||||
|
max_depth: 4
|
||||||
|
tags:
|
||||||
|
- 调试记录
|
||||||
|
- MPSoC
|
||||||
|
- RFSoC
|
||||||
|
- Zynq
|
||||||
|
- FSBL
|
||||||
|
categories:
|
||||||
|
- 调试记录
|
||||||
|
date: 2024-06-29 16:46:38
|
||||||
|
---
|
||||||
|
|
||||||
|
FSBL 可以初始化 SoC 设备,将所需的应用程序或数据加载到内存,并在目标 CPU 核心上启动应用程序。
|
||||||
|
|
||||||
|
在 Vitis 中创建 Platform 时,可以选择同时创建 FSBL,这样 FSBL 就会位于 Platform 下。也可以创建单独的 FSBL 程序,作为普通程序使用,以便进一步修改或调试。
|
||||||
|
|
||||||
|
本文以 Zynq UltraScale+ RFSoC 为例,对 FSBL 进行调试。
|
||||||
|
|
||||||
|
# 名词释义
|
||||||
|
|
||||||
|
- [FSBL](https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842019/Zynq+UltraScale+FSBL#ZynqUltraScale+FSBL-WhatisFSBL?):First Stage Bootloader,第一阶段引导加载程序
|
||||||
|
- [SoC](https://en.wikipedia.org/wiki/System_on_a_chip):System-on-Chip,片上系统
|
||||||
|
|
||||||
|
# 参考文档
|
||||||
|
|
||||||
|
[Creating a Debuggable First Stage Boot Loader](https://xilinx.github.io/Embedded-Design-Tutorials/docs/2021.1/build/html/docs/Feature_Tutorials/debuggable-fsbl/debuggable-fsbl.html)
|
||||||
@@ -38,7 +38,7 @@ $$\begin{equation}\label{DefinitionOfConvexFunction}
|
|||||||
f(\theta x+(1-\theta)y)\leqslant\theta f(x)+(1-\theta)f(y)
|
f(\theta x+(1-\theta)y)\leqslant\theta f(x)+(1-\theta)f(y)
|
||||||
\end{equation}$$
|
\end{equation}$$
|
||||||
|
|
||||||
  从几何意义上看,上述不等式意味着点 $(x,f(x))$ 和 $(y,f(y))$ 之间的线段,即从 $x$ 到 $y$ 的**弦**(*chord*),在函数 $f$ 的图像上方(如[图 1](#图1)所示)。称函数 $f$ 是**严格凸**(*strictly convex*)的,如果式 $\eqref{DefinitionOfConvexFunction}$ 中的不等式当 $x\neq y$ 以及 $0<\theta<1$ 时严格成立。称函数 $f$ 是**凹**(*concave*)的,如果函数 $-f$ 是凸的,称函数 $f$ 是**严格凹**(*strictly concave*)的,如果 $-f$ 严格凸。
|
  从几何意义上看,上述不等式意味着点 $(x,f(x))$ 和 $(y,f(y))$ 之间的线段,即从 $x$ 到 $y$ 的**弦**(*chord*),在函数 $f$ 的图像上方(如[图 1](#图1)所示)。称函数 $f$ 是**严格凸**(*strictly convex*)的,如果式 $\eqref{DefinitionOfConvexFunction}$ 中的不等式当 $x\neq y$ 以及 $0<\theta<1$ 时严格成立。称函数 $f$ 是**凹**(*concave*)的,如果函数 $-f$ 是凸的,称函数 $f$ 是**严格凹**(*strictly concave*)的,如果 $-f$ 严格凸。
|
||||||
|
|
||||||
<a id="图1"></a>
|
<a id="图1"></a>
|
||||||
|
|
||||||
@@ -46,9 +46,26 @@ $$\begin{equation}\label{DefinitionOfConvexFunction}
|
|||||||
|
|
||||||
<!-- more -->
|
<!-- more -->
|
||||||
|
|
||||||
  对于仿射函数,不等式 $\eqref{DefinitionOfConvexFunction}$ 总成立,因此所有的仿射函数(包括线性函数)是既凸且凹的。反之,若某个函数是既凸又凹的,则其是仿射函数。
|
  对于仿射函数,式 $\eqref{DefinitionOfConvexFunction}$ 始终可以取等号,因此所有的[仿射函数][](包括线性函数)是既凸且凹的。反之,若某个函数是既凸又凹的,则其是仿射函数。
|
||||||
|
|
||||||
  函数是凸的,当且仅当其在与其定义域相交的任何直线上都是凸的。换言之,函数 $f$ 是凸的,当且仅当对于任意 $x\in\dom f$ 和任意向量 $v$,函数 $g(t)=f(x+tv)$ 是凸的(其定义域为 $\{t\mid x+tv\in\dom f\}$)。这个性质非常有用,因为它容许我们通过将函数限制在直线上来判断其是否是凸函数。
|
  函数是凸的,当且仅当其在与其定义域相交的任何直线上都是凸的。换言之,函数 $f$ 是凸的,当且仅当对于任意 $x\in\dom f$ 和任意向量 $v$,函数 $g(t)=f(x+tv)$ 是凸的(其定义域为 $\{t\mid x+tv\in\dom f\}$)。这个性质非常有用,因为它让我们可以通过将函数限制在直线上来判断其是否是凸函数。
|
||||||
|
|
||||||
|
{% note info %}
|
||||||
|
|
||||||
|
这里可能是由于翻译问题导致不是很好理解,我们先看原文:
|
||||||
|
|
||||||
|
> A function is convex if and only if it is convex when restricted to any line that
|
||||||
|
intersects its domain. In other words f is convex if and only if for all $x\in\mathbf{dom}\, f$ and all $v$, the function $g(t) = f(x + tv)$ is convex (on its domain, $\{t\mid x+tv\in\mathbf{dom}\, f\}$). This property is very useful, since it allows us to check whether a function is convex by restricting it to a line.
|
||||||
|
|
||||||
|
仍然不是很好理解。因此这里如下解释:
|
||||||
|
|
||||||
|
- 限制在直线上:考虑一个函数 $f$ 和其定义域内的任意一点 $x$。再选择一个任意方向向量 $v$。我们沿着这个方向 $v$ 从点 $x$ 出发,得到一条直线。任何点 $x+tv$(其中 $t$ 是一个实数)都在这条直线上。这就叫做将函数限制在直线上。
|
||||||
|
|
||||||
|
- 直线上的函数:我们定义一个新的函数 $g(t)=f(x+tv)$。这个新的函数 $g(t)$ 表示原函数 $f$ 在直线$x+tv$上的值。
|
||||||
|
|
||||||
|
- 检查凸性:如果对于任意 $x$ 和 $v$,新的函数 $g(t)$ 是凸的,那么我们就说原函数 $f$ 是凸的。也就是说,如果 $f$ 在所有限制的直线上都是凸的,那么 $f$ 本身就是凸的。
|
||||||
|
|
||||||
|
{% endnote %}
|
||||||
|
|
||||||
  对凸函数的**分析**(*analysis*)已经相当地透彻,这里不再继续深入。例如有这样一个简单的结论,凸函数在其定义域相对内部是连续的;它只可能在相对边界上不连续。
|
  对凸函数的**分析**(*analysis*)已经相当地透彻,这里不再继续深入。例如有这样一个简单的结论,凸函数在其定义域相对内部是连续的;它只可能在相对边界上不连续。
|
||||||
|
|
||||||
@@ -531,3 +548,5 @@ $$
|
|||||||
|
|
||||||
1. Stephen P. Boyd and Lieven Vandenberghe, *Convex optimization*. Cambridge, UK: Cambridge University Press, 2004.
|
1. Stephen P. Boyd and Lieven Vandenberghe, *Convex optimization*. Cambridge, UK: Cambridge University Press, 2004.
|
||||||
2. Stephen P. Boyd and Lieven Vandenberghe, *凸优化*. 北京: 清华大学出版社, 2013.
|
2. Stephen P. Boyd and Lieven Vandenberghe, *凸优化*. 北京: 清华大学出版社, 2013.
|
||||||
|
|
||||||
|
[仿射函数]: https://josh-gao.top/posts/a4a69a4f.html?#%E4%BB%BF%E5%B0%84%E5%87%BD%E6%95%B0
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
---
|
||||||
|
title: Josh's Note — 凸优化<br>Part 2.1 凸函数—保凸运算
|
||||||
|
mathjax: true
|
||||||
|
comments: true
|
||||||
|
copyright: true
|
||||||
|
toc:
|
||||||
|
enable: true
|
||||||
|
number: false
|
||||||
|
wrap: true
|
||||||
|
expand_all: true
|
||||||
|
max_depth: 4
|
||||||
|
categories:
|
||||||
|
- - Josh 的学习笔记
|
||||||
|
- 凸优化
|
||||||
|
- 凸函数
|
||||||
|
- - 数学
|
||||||
|
- 凸优化
|
||||||
|
tags:
|
||||||
|
- 凸优化
|
||||||
|
- 凸函数
|
||||||
|
abbrlink: c3476904
|
||||||
|
date: 2024-07-03 23:04:33
|
||||||
|
---
|
||||||
|
|
||||||
|
$
|
||||||
|
\newcommand{\dd}{\mathrm{d}}
|
||||||
|
\def\dom{\mathop{\bf dom}}
|
||||||
|
\def\epi{\mathop{\bf epi}}
|
||||||
|
$  本文讨论几种保持函数凸性或者凹性的运算,这样可以构造新的凸函数或者凹函数。首先从一些简单的运算开始,如求和、伸缩以及逐点上确界,之后再介绍一些更为复杂的运算(其中一些运算的特例即为简单运算)。
|
||||||
|
|
||||||
|
# 1. 非负加权求和
|
||||||
|
|
||||||
|
  显然,如果函数 $f$ 是凸函数且 $\alpha\geqslant0$,则函数 $\alpha f$ 也为凸函数。如果函数 $f_1$ 和 $f_2$ 都是凸函数,则它们的和 $f_1+f_2$ 也是凸函数。将非负伸缩以及求和运算结合起来,可以看出,凸函数的集合本身是一个凸锥:凸函数的非负加权求和仍然是凸函数,即函数
|
||||||
|
|
||||||
|
$$
|
||||||
|
f=w_1f_1+\cdots+w_mf_m
|
||||||
|
$$
|
||||||
|
|
||||||
|
是凸函数。类似地,凹函数的非负加权求和仍然是凹函数。严格凸(凹)函数的非负,非零加权求和是严格凸(凹)函数。
|
||||||
|
|
||||||
|
  这个性质可以扩展至无限项的求和以及积分的情形。例如,如果固定任意 $y\in\mathcal{A}$,函数 $f(x,y)$ 关于 $x$ 是凸函数,且对任意 $y\in\mathcal{A}$,有$w(y)\geqslant0$,则函数 $g$
|
||||||
|
|
||||||
|
$$
|
||||||
|
g(x)=\int_{\mathcal{A}}w(y)f(x,y)\dd y
|
||||||
|
$$
|
||||||
|
|
||||||
|
关于$x$是凸函数(若此积分存在)。
|
||||||
|
|
||||||
|
<!-- more -->
|
||||||
|
|
||||||
|
  我们可以很容易直接验证非负伸缩以及求和运算是保凸运算,或者可以根据相关的上境图得到此结论。例如,如果 $w\geqslant0$ 且 $f$ 是凸函数,有
|
||||||
|
|
||||||
|
$$
|
||||||
|
\epi (wf)=\left[\begin{array}{cc}
|
||||||
|
I&0\\
|
||||||
|
0&w
|
||||||
|
\end{array}\right]\epi f
|
||||||
|
$$
|
||||||
|
|
||||||
|
因为凸集通过线性变换得到的像仍然是凸集,所以 $\epi(wf)$是凸集。
|
||||||
|
|
||||||
|
# 2. 复合仿射映射
|
||||||
|
|
||||||
|
  假设函数 $f:\mathbf{R}^n\to\mathbf{R}$,$A\in\mathbf{R}^{n\times m}$,以及 $b\in\mathbf{R}^n$,定义 $g:\mathbf{R}^m\to\mathbf{R}$ 为
|
||||||
|
|
||||||
|
$$
|
||||||
|
g(x)=f(Ax+b)
|
||||||
|
$$
|
||||||
|
|
||||||
|
其中$\dom g=\{x\mid Ax+b\in\dom f\}$。若函数 $f$ 是凸函数,则函数 $g$ 是凸函数;如果函数 $f$ 是凹函数,那么函数 $g$ 是凹函数。
|
||||||
|
|
||||||
|
# 3. 逐点最大和逐点上确界
|
||||||
|
|
||||||
|
  如果函数 $f_{1}$ 和 $f_{2}$ 均为凸函数,则二者的逐点最大函数 $f$
|
||||||
|
|
||||||
|
$$
|
||||||
|
f(x)=\max\{f_1(x),f_2(x)\}
|
||||||
|
$$
|
||||||
|
|
||||||
|
其定义域为$\dom f=\dom f_1\cap\dom f_2$,仍然是凸函数。这个性质可以很容易验证:任取 $0\leqslant \theta \leqslant 1$ 以及 $x,y\in\dom f$,有
|
||||||
|
|
||||||
|
$$\begin{aligned}
|
||||||
|
f(\theta x+(1-\theta)y)&=\max\{f_1(\theta x+(1-\theta)y),f_2(\theta x+(1-\theta)y)\}
|
||||||
|
\\
|
||||||
|
&\leqslant\max\{\theta f_1(x)+(1-\theta)f_1(y),\theta f_2(x)+(1-\theta)f_2(y)\}
|
||||||
|
\\
|
||||||
|
&\leqslant\theta\max\{f_1(x),f_2(x)\}+(1-\theta)\max\{f_1(y),f_2(y)\}
|
||||||
|
\\
|
||||||
|
&=\theta f(x)+(1-\theta)f(y)
|
||||||
|
\end{aligned}$$
|
||||||
|
|
||||||
|
从而说明了函数 $f$ 的凸性。同样很容易证明,如果函数 $f_1,\cdots,f_m$ 为凸函数,则它们的逐点最大函数
|
||||||
|
|
||||||
|
$$
|
||||||
|
f(x)=\max\{f_1(x),\cdots,f_m(x)\}
|
||||||
|
$$
|
||||||
|
|
||||||
|
仍然是凸函数。
|
||||||
Reference in New Issue
Block a user