728x90

출처

OS 업그레이드

X
user@localhost:~

[user@localhost]$ sudo apt-get update
[user@localhost]$ sudo apt-get upgrade

기존 전치된 lazarus 삭제

X
user@localhost:~

[user@localhost]$ sudo apt-get remove lazarus
[user@localhost]$ sudo apt-get remove fpc
[user@localhost]$ sudo apt-get autoremove
[user@localhost]$ sudo shutdown -r now

Swap 파일 크기 늘리기

여유 공간 확인

X
user@localhost:~

[user@localhost]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        15G  8.3G  5.5G  61% /
devtmpfs        943M     0  943M   0% /dev
tmpfs          1007M     0 1007M   0% /dev/shm
tmpfs          1007M  8.9M  998M   1% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs          1007M     0 1007M   0% /sys/fs/cgroup
/dev/mmcblk1p1   63M  7.5M   56M  12% /boot
tmpfs           202M  8.0K  202M   1% /run/user/1000

Swap 설정 파일 수정

X
user@localhost:~

[user@localhost]$ sudo vi /etc/dphys-swapfile

Swap 사이즈 설정

CONF_SWAPSIZE=1000

Swap 설정 파일을 저장하고 스와핑을 다시 시작

X
user@localhost:~

[user@localhost]$ sudo /etc/init.d/dphys-swapfile stop
Stopping dphys-swapfile (via systemctl): dphys-swapfile.service.
[user@localhost]$ sudo /etc/init.d/dphys-swapfile start
Starting dphys-swapfile (via systemctl): dphys-swapfile.service.
[user@localhost]$ ls -lh /var
total 1001M
drwxr-xr-x  2 root root   4.0K Sep 16 01:22 backups
drwxr-xr-x 11 root root   4.0K Jul 21 10:44 cache
drwxr-xr-x 49 root root   4.0K Jul 21 20:09 lib
drwxrwsr-x  2 root staff  4.0K Nov 19  2017 local
lrwxrwxrwx  1 root root      9 Jan 10  2018 lock -> /run/lock
drwxr-xr-x  7 root root   4.0K Sep 16 03:29 log
drwxrwsr-x  2 root mail   4.0K Jan 10  2018 mail
drwxr-xr-x  2 root root   4.0K Jan 10  2018 opt
lrwxrwxrwx  1 root root      4 Jan 10  2018 run -> /run
drwxr-xr-x  7 root root   4.0K Jul 21 10:43 spool
-rw-------  1 root root  1000M Sep 16 03:43 swap
drwxrwxrwt  6 root root   4.0K Sep 16 03:30 tmp

Seed/Bootstrap Pascal Compiler 설치

X
user@localhost:~

[user@localhost]$ mkdir /usr/local/fpc
[user@localhost]$ wget ftp://ftp.hu.freepascal.org/pub/fpc/dist/3.0.4/arm-linux/fpc-3.0.4.arm-linux-eabihf-raspberry.tar
[user@localhost]$ tar xvf fpc-3.0.4.arm-linux-eabihf-raspberry.tar
fpc-3.0.4.arm-linux/
fpc-3.0.4.arm-linux/doc-pdf.tar.gz
fpc-3.0.4.arm-linux/binary.arm-linux.tar
fpc-3.0.4.arm-linux/install.sh
fpc-3.0.4.arm-linux/demo.tar.gz
[user@localhost]$ mv fpc-3.0.4.arm-linux /usr/local/fpc/
[user@localhost]$ cd /usr/local/fpc/fpc-3.0.4.arm-linux/
[user@localhost]$ sudo ./install.sh

설치과정

linaro@tinkerboard:/usr/local/fpc/fpc-3.0.4.arm-linux$ sudo ./install.sh 
This shell script will attempt to install the Free Pascal Compiler
version 3.0.4 with the items you select

Install prefix (/usr or /usr/local)  [/usr] : 
Installing compiler and RTL for arm-linux...

Install Textmode IDE (Y/n) ? 
Done.

Install documentation (Y/n) ? 
Installing documentation in /usr/share/doc/fpc-3.0.4 ...
Done.

Install demos (Y/n) ? 
Install demos in [/usr/share/doc/fpc-3.0.4/examples] : 
Installing demos in /usr/share/doc/fpc-3.0.4/examples ...
Done.

Running on linux
Write permission in /etc.
Writing sample configuration file to /etc/fpc.cfg
Writing sample configuration file to /usr/lib/fpc/3.0.4/ide/text/fp.cfg
Writing sample configuration file to /usr/lib/fpc/3.0.4/ide/text/fp.ini
Writing sample configuration file to /etc/fppkg.cfg
Writing sample configuration file to /etc/fppkg/default

End of installation.

Refer to the documentation for more information.

svn 클라이언트 설치

X
user@localhost:~

[user@localhost]$ sudo apt-get install subversion

관련 라이브러리 설치

X
user@localhost:~

[user@localhost]$ sudo apt-get install libgtk2.0-dev libcairo2-dev libpango1.0-dev libgdk-pixbuf2.0-dev libatk1.0-dev libghc-x11-dev libx11-dev

Free Pascal 설치

X
user@localhost:~

[user@localhost]$ cd /usr/local/fpc
[user@localhost]$ svn co http://svn.freepascal.org/svn/fpc/trunk source
[user@localhost]$ cd source
[user@localhost]$ sudo make all OPT="-dFPC_ARMHF -CpARMV7A -OpARMV7A"
[user@localhost]$ sudo make install OPT="-dFPC_ARMHF -CpARMV7A -OpARMV7A" PREFIX=/usr/local
[user@localhost]$ sudo make install sourceinstall OPT="-dFPC_ARMHF -CpARMV7A -OpARMV7A" PREFIX=/usr/local

설치된 pascal 버전 확인

X
user@localhost:~

[user@localhost]$ ls /usr/lib/fpc
3.0.4  lexyacc

fpc 최신 버전으로 심볼릭 링크 걸기

X
user@localhost:~

[user@localhost]$ ls -al /usr/bin/ppcarm
lrwxrwxrwx 1 root root 25 Sep 16 11:23 /usr/bin/ppcarm -> /usr/lib/fpc/3.0.4/ppcarm

fpc 컴파일러 버전 확인

X
user@localhost:~

[user@localhost]$ fpc -iW
3.0.4

Lazarus 설치

관련 라이브러리 설치

X
user@localhost:~

[user@localhost]$ sudo apt-get install libx11-dev libgdk-pixbuf2.0-dev libcairo2-dev gir1.2-coglpango-1.0 libpangox-1.0-dev xorg-dev libgtk2.0-dev libpango1.0-dev

Lazarus 다운로드 및 컴파일

X
user@localhost:~

[user@localhost]$ mkdir /usr/local/lazarus
[user@localhost]$ cd /usr/local/lazarus
[user@localhost]$ sudo wget https://jaist.dl.sourceforge.net/project/lazarus/Lazarus%20Zip%20_%20GZip/Lazarus%201.8.4/lazarus-1.8.4.tar.gz
[user@localhost]$ sudo tar -xvf lazarus-1.8.4.tar.gz
[user@localhost]$ cd lazarus/
[user@localhost]$ sudo make all OPT="-dFPC_ARMHF -CpARMV7A -OpARMV7A"
[user@localhost]$ sudo make install OPT="-dFPC_ARMHF -CpARMV7A -OpARMV7A" PREFIX=/usr/local

gcc 라이브러리 경로 설정

컴파일하면 crtbegin.o 및 crtend.o를 찾을 수 없다는 경고가 출력됩니다. 경고가 표지 되지 않도록 설정

crtbegin.o 찾기

X
user@localhost:~

[user@localhost]$ sudo find / -name crtbegin.o
/usr/lib/gcc/arm-linux-gnueabihf/6/crtbegin.o

fpc 환경 파일 (fpc.cfg) 수정

X
user@localhost:~

[user@localhost]$ sudo vi /etc/fpc.cfg

내용 추가

# path to the gcclib
-Fl/usr/lib/gcc/arm-linux-gnueabihf/6

gdb 설치

X
user@localhost:~

[user@localhost]$ sudo apt-get install gdb-multiarch

Lazarus 실행

fpc 경로 오류

fpc 경로 찾기

fpc 경로 설정

Lazarus 실행화면

728x90
728x90

출처 : 델마당 - 라즈베리 파이(Raspberry Pi) 보드 크로스 컴파일 환경 구축 성공(Win7 => 라즈베리)
Cross-Build for RasberryPi
TOPIC: How to build app for Raspberry Pi from Windows 7
Setup Cross Compile For ARM

Lazarus

Lazarus라는 RAD툴 입니다.
아직 설치 방법은 작성중이고, 우선 개발된 소스와 실행 파일을 올립니다.
기본언어는 Pascal 이고, 상용툴로 Delphi와 비슷합니다.
Raspberry PI용 화면개발을 하실 일이 있다면 편하게 작성하실수 있습니다.

설치방법과 GPIO관련 내용은 따로 작성해서 올리겠습니다.

GPIO 컴포넌트

rpi-hal 링크

CodeTyphon 다운로드

Cross-Build for RasberryPi 다운로드

설치

CodeTyphonIns\install.bat 관리자로 실행

Lazarus 실행

화면디자인

소스코드 Unit1.pas project1.zip

unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    procedure Button1Click(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
begin
  //
  Edit1.Text := 'Hello Raspberry !!!';
end;

end.

Windows에서 실행

 

Raspberry PI 용 컴파일 옵션 설정

Raspberry PI에서 실행

 

728x90

+ Recent posts