# apt update # apt install emacs-nox
■emacs-noxについて
GNU Emacs editor (metapackage, without X support)
■補足
emacs-noxではホイールマウスの設定は使えないようです。.emacsの該当部分をコメントアウトする
;;;; ホイールマウス ;(mouse-wheel-mode t) ;(setq mouse-wheel-follow-mouse t)
# apt update # apt install emacs-nox
;;;; ホイールマウス ;(mouse-wheel-mode t) ;(setq mouse-wheel-follow-mouse t)
どうやらavr-libcのバージョンが異なるのが原因のようです。
・binutils-2.29.1.tar.xz
https://www.gnu.org/software/binutils/
・gcc-7.2.0.tar.xz
https://gcc.gnu.org/
・gmp-6.1.2.tar.xz
https://gmplib.org/
・mpfr-3.1.6.tar.xz
http://www.mpfr.org/
・mpc-1.0.3.tar.gz
http://www.multiprecision.org/index.php?prog=mpc
・avr-libc-2.0.0.tar.bz2
http://www.nongnu.org/avr-libc/
・avr-size用パッチ
https://gist.github.com/larsimmisch/4190960
$ mkdir ~/local $ PREFIX=$HOME/local $ export PREFIX $ PATH=$PATH:$PREFIX/bin $ export PATH
$ cd ~/src/avr $ wget https://ftp.gnu.org/gnu/binutils/binutils-2.29.1.tar.xz $ tar xvf binutils-2.29.1.tar.xz $ wget https://gist.github.com/larsimmisch/4190960/archive/16c6b9627f8451eeebd644a4b9a741edfdb0c45e.zip $ unzip 16c6b9627f8451eeebd644a4b9a741edfdb0c45e.zip $ cd binutils-2.29.1/binutils $ patch -u < ../../4190960-16c6b9627f8451eeebd644a4b9a741edfdb0c45e/avr-binutils-size.patch $ cd .. $ mkdir obj-avr $ cd obj-avr/ $ ../configure --prefix=$PREFIX --target=avr --disable-nls $ make -j4 $ make install
$ cd ~/src/avr $ wget https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz $ tar xvf gmp-6.1.2.tar.xz $ cd gmp-6.1.2/ $ ./configure --prefix=$PREFIX $ make -j4 $ make -j4 check $ make install
$ cd ~/src/avr $ wget http://www.mpfr.org/mpfr-current/mpfr-3.1.6.tar.xz $ tar xvf mpfr-3.1.6.tar.xz $ cd mpfr-3.1.6 $ ./configure --prefix=$PREFIX --with-gmp-build=../gmp-6.1.2 $ make -j4 $ make -j4 check $ make install
$ cd ~/src/avr $ wget ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz $ tar xvf mpc-1.0.3.tar.gz $ cd mpc-1.0.3 $ ./configure --prefix=$PREFIX --with-gmp=$PREFIX --with-mpfr=$PREFIX $ make -j4 $ make -j4 check $ make install
$ cd ~/src/avr $ wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-7.2.0/gcc-7.2.0.tar.xz $ tar xvf gcc-7.2.0.tar.xz $ cd gcc-7.2.0/ $ mkdir obj-avr $ cd obj-avr $ ../configure --prefix=$PREFIX --target=avr --enable-languages=c,c++ --disable-nls --disable-libssp --with-dwarf2 --with-gmp=$PREFIX --with-mpfr=$PREFIX --with-mpc=$PREFIX $ make -j4 $ make install
$ cd ~/src/avr $ wget http://download.savannah.gnu.org/releases/avr-libc/avr-libc-2.0.0.tar.bz2 $ tar xvf avr-libc-2.0.0.tar.bz2 $ cd avr-libc-2.0.0/ $ ./configure --prefix=$PREFIX --build=`./config.guess` --host=avr $ make -j4 $ make install
■Raspberry Pi(Raspbian)でAVR開発環境を構築する手順
# apt update # apt upgrade # apt install gcc-avr binutils-avr avr-libc avrdudeRaspberry PiでAVR開発するメリットは、「ソース修正→ISP書き込み」が気軽にどこでもできるということに尽きます。Raspberry Piに移行する前はノートPCのAVR開発環境にAVRISPmkIIを接続してデバッグしていたのですが、この場合、開発対象とノートPCをAVRISPmkIIのケーブルが届く範囲に留める必要があり、結局のところ、開発対象の近くにノートPCを持っていくしかありませんでした。
こちらの記事「My Christmas Gift: Mandelbrot Set Computation In Python」を参考にマンデルブロ集合を表示させてみたので備忘録として残します。
import numpy as np
from numba import jit
from tqdm import tqdm
@jit
def mandelbrot(z,maxiter,horizon,log_horizon):
c = z
for n in range(maxiter):
az = abs(z)
if az > horizon:
return n - np.log(np.log(az))/np.log(2) + log_horizon
z = z*z + c
return 0
@jit
def mandelbrot_set(xmin,xmax,ymin,ymax,width,height,maxiter):
horizon = 2 ** 40
log_horizon = np.log(np.log(horizon))/np.log(2)
r1 = np.linspace(xmin, xmax, width)
r2 = np.linspace(ymin, ymax, height)
n3 = np.empty((width,height))
for i in tqdm(range(width)):
for j in range(height):
n3[i,j] = mandelbrot(r1[i] + 1j*r2[j],maxiter,horizon, log_horizon)
return (r1,r2,n3)
from matplotlib import pyplot as plt
from matplotlib import colors
%matplotlib inline
def mandelbrot_image(x,y,radius,width=10,height=10,maxiter=80,cmap='jet',gamma=0.3):
dpi = 72
img_width = dpi * width
img_height = dpi * height
xmin = x - radius
xmax = x + radius
ymin = y - radius
ymax = y + radius
x,y,z = mandelbrot_set(xmin,xmax,ymin,ymax,img_width,img_height,maxiter)
fig, ax = plt.subplots(figsize=(width, height),dpi=72)
ticks = np.arange(0,img_width,3*dpi)
x_ticks = xmin + (xmax-xmin)*ticks/img_width
plt.xticks(ticks, x_ticks)
y_ticks = ymin + (ymax-ymin)*ticks/img_width
plt.yticks(ticks, y_ticks)
ax.set_title(cmap)
norm = colors.PowerNorm(gamma)
cax = ax.imshow(z.T,cmap=cmap,origin='lower',norm=norm)
fig.colorbar(cax, shrink=0.82)
plt.show()
mandelbrot_image(-0.75, 0, 1.5, cmap='hot', gamma=0.4)
mandelbrot_image(0.2501, 1.6e-6, 1e-8, maxiter=1e4)
mandelbrot_image(0.3007100003, 0.02006000303, 1e-10, maxiter=2048, cmap='hot', gamma=0.4)
mandelbrot_image(-0.74958245,0.0300396,1e-6, maxiter=30000, cmap='copper')
mandelbrot_image(-0.74997501, -0.00999551, 1e-8, maxiter=1e5, cmap='flag', gamma=0.98)