embeded/Cortex-M3 Ti2015. 8. 3. 17:19

요약하면..

GPIOPortIntRegister(GPIO_PORTA_BASE, PortAIntHandler);

GPIOPinTypeGPIOInput(GPIO_PORTA_BASE,GPIO_PIN_2);

GPIOIntTypeSet(GPIO_PORTA_BASE, GPIO_PIN_2, GPIO_RISING_EDGE);

GPIOPinIntEnable(GPIO_PORTA_BASE, GPIO_PIN_2);

이렇게 셋트로 해주면 P2는 rising_edge에서 PortAIntHandler 핸들러를 호출하게 되는건가?


그리고 핸들러에서는

GPIOPinIntStatus 를 사용해서 핀 별로 처리해주면 될 듯?


9.2.2.11 GPIOPinIntStatus

Gets interrupt status for the specified GPIO port.

Prototype:

long GPIOPinIntStatus(unsigned long ulPort, tBoolean bMasked)

Parameters:

ulPort is the base address of the GPIO port.

bMasked specifies whether masked or raw interrupt status is returned.

Description:

If bMasked is set as true, then the masked interrupt status is returned; otherwise, the raw interrupt status will be returned.

Returns:

Returns a bit-packed byte, where each bit that is set identifies an active masked or raw interrupt, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. Bits 31:8 should be ignored. 



9.3 Programming Example

The following example shows how to use the GPIO API to initialize the GPIO, enable interrupts,

read data from pins, and write data to pins.

int iVal;
//
// Register the port-level interrupt handler. This handler is the
// first level interrupt handler for all the pin interrupts.
//
GPIOPortIntRegister(GPIO_PORTA_BASE, PortAIntHandler);
//
// Initialize the GPIO pin configuration.
//
// Set pins 2, 4, and 5 as input, SW controlled.
//
GPIOPinTypeGPIOInput(GPIO_PORTA_BASE,
GPIO_PIN_2 | GPIO_PIN_4 | GPIO_PIN_5);
//
// Set pins 0 and 3 as output, SW controlled.
//
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_3);
//
// Make pins 2 and 4 rising edge triggered interrupts.
//
GPIOIntTypeSet(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_4, GPIO_RISING_EDGE);
//
// Make pin 5 high level triggered interrupts.
//
GPIOIntTypeSet(GPIO_PORTA_BASE, GPIO_PIN_5, GPIO_HIGH_LEVEL);
//
// Read some pins.
//
iVal = GPIOPinRead(GPIO_PORTA_BASE,
(GPIO_PIN_0 | GPIO_PIN_2 | GPIO_PIN_3 |
GPIO_PIN_4 | GPIO_PIN_5));
//
// Write some pins. Even though pins 2, 4, and 5 are specified, those
// pins are unaffected by this write since they are configured as inputs.
// At the end of this write, pin 0 will be a 0, and pin 3 will be a 1.
//
GPIOPinWrite(GPIO_PORTA_BASE,
(GPIO_PIN_0 | GPIO_PIN_2 | GPIO_PIN_3 |
GPIO_PIN_4 | GPIO_PIN_5),
0xF4);
//
// Enable the pin interrupts.
//
GPIOPinIntEnable(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_4 | GPIO_PIN_5);



9.2.2.4 GPIOIntTypeSet

Sets the interrupt type for the specified pin(s).


Prototype:

void GPIOIntTypeSet(unsigned long ulPort, unsigned char ucPins, unsigned long ulIntType)

Parameters:

ulPort is the base address of the GPIO port.

ucPins is the bit-packed representation of the pin(s).

ulIntType specifies the type of interrupt trigger mechanism.

Description:

This function sets up the various interrupt trigger mechanisms for the specified pin(s) on the selected GPIO port.

The parameter ulIntType is an enumerated data type that can be one of the following values:

GPIO_FALLING_EDGE

GPIO_RISING_EDGE

GPIO_BOTH_EDGES

GPIO_LOW_LEVEL

GPIO_HIGH_LEVEL

where the different values describe the interrupt detection mechanism (edge or level) and the particular triggering event (falling, rising, or both edges for edge detect, low or high for level detect).

The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.

Note:

In order to avoid any spurious interrupts, the user must ensure that the GPIO inputs remain stable for the duration of this function.

Returns:

None.





[링크 : https://e2e.ti.com/support/microcontrollers/stellaris_arm/f/471/t/48738]

[링크 : http://elk.informatik.fh-augsburg.de/cdrom-stellaris/LM3S811/rasware-read-only/RASLib/src/encoder.c]

    [링크 : http://elk.informatik.fh-augsburg.de/cdrom-stellaris/LM3S811/rasware-read-only/RASLib/src/]

'embeded > Cortex-M3 Ti' 카테고리의 다른 글

lm3s stellarisware SPI  (0) 2015.10.05
cortex-m3 ROM direct call  (0) 2015.09.25
bitband / cortex-m3  (0) 2013.08.16
LM3S1968과 H-JTAG(wiggler)  (0) 2013.06.28
cortex-m3 JTAG / X-LinkEx 1.1  (0) 2013.06.11
Posted by 구차니
프로그램 사용/clang2015. 8. 3. 16:57

test.c:3:1: error: 'main' must return 'int'

clang은 int main() 아니면 배쨰는 중 -_-


음.. 코드가 허접한거라..

$ cat test.c

#include <stdio.h>


int main()

{

        int *p;


        free(p);

        return 0;

} 


시간은 큰 의미가 없지만.. 아무튼 빌드가 아니라 --analyze만 해서는

빠르게 작동하는 걸 보니 꽤 쓸만해 보이기도?


$ time gcc -o gcc.o test.c

test.c: In function ‘main’:

test.c:7:2: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default]


real    0m0.611s

user    0m0.510s

sys     0m0.070s


$ time clang -o gcc.o test.c

test.c:7:2: warning: implicit declaration of function 'free' is invalid in C99

      [-Wimplicit-function-declaration]

        free(p);

        ^

1 warning generated.


real    0m0.728s

user    0m0.560s

sys     0m0.110s



$ time clang -o gcc.o test.c --analyze

test.c:7:2: warning: Function call argument is an uninitialized value

        free(p);

        ^    ~

1 warning generated.


real    0m0.325s

user    0m0.220s

sys     0m0.080s



$ time gcc -o gcc.o test.c -fsyntax-only
test.c: In function ‘main’:
test.c:7:2: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default]

real    0m0.185s
user    0m0.140s
sys     0m0.030s

어?


'프로그램 사용 > clang' 카테고리의 다른 글

semgrep  (0) 2023.04.17
cppcheck 사용  (0) 2023.04.17
clang on ubnutu  (0) 2015.08.03
llvm / clang / cppcheck  (0) 2015.02.21
Posted by 구차니
프로그램 사용/clang2015. 8. 3. 16:05

clang이 요즘 뜨는건지.. 한번 해보려는데.. 흐음...

일단 귀차니즘으로.. (-_-) 라즈베리 파이에 ㅋㅋ


$ sudo apt-get install clang

패키지 목록을 읽는 중입니다... 완료

의존성 트리를 만드는 중입니다

상태 정보를 읽는 중입니다... 완료

다음 패키지를 더 설치할 것입니다:

  libclang-common-dev libffi-dev libllvm3.0 llvm-3.0 llvm-3.0-dev llvm-3.0-runtime

제안하는 패키지:

  llvm-3.0-doc

다음 새 패키지를 설치할 것입니다:

  clang libclang-common-dev libffi-dev libllvm3.0 llvm-3.0 llvm-3.0-dev llvm-3.0-runtime

0개 업그레이드, 7개 새로 설치, 0개 제거 및 0개 업그레이드 안 함.

24.2 M바이트 아카이브를 받아야 합니다.

이 작업 후 71.3 M바이트의 디스크 공간을 더 사용하게 됩니다.

계속 하시겠습니까 [Y/n]?

받기:1 http://mirrordirector.raspbian.org/raspbian/ wheezy/main libllvm3.0 armhf 3.0-10 [6,778 kB]

받기:2 http://mirrordirector.raspbian.org/raspbian/ wheezy/main libclang-common-dev armhf 1:3.0-6.2 [76.7 kB]

받기:3 http://mirrordirector.raspbian.org/raspbian/ wheezy/main clang armhf 1:3.0-6.2 [4,510 kB]

받기:4 http://mirrordirector.raspbian.org/raspbian/ wheezy/main libffi-dev armhf 3.0.10-3+b3 [113 kB]

받기:5 http://mirrordirector.raspbian.org/raspbian/ wheezy/main llvm-3.0-runtime armhf 3.0-10 [40.7 kB]

받기:6 http://mirrordirector.raspbian.org/raspbian/ wheezy/main llvm-3.0 armhf 3.0-10 [1,215 kB]

받기:7 http://mirrordirector.raspbian.org/raspbian/ wheezy/main llvm-3.0-dev armhf 3.0-10 [11.5 MB]

내려받기 24.2 M바이트, 소요시간 17초 (1,386 k바이트/초)

Selecting previously unselected package libllvm3.0:armhf.

(데이터베이스 읽는중 ...현재 120356개의 파일과 디렉터리가 설치되어 있습니다.)

libllvm3.0:armhf 패키지를 푸는 중입니다 (.../libllvm3.0_3.0-10_armhf.deb에서) ...

Selecting previously unselected package libclang-common-dev.

libclang-common-dev 패키지를 푸는 중입니다 (.../libclang-common-dev_1%3a3.0-6.2_armhf.deb에서) ...

Selecting previously unselected package clang.

clang 패키지를 푸는 중입니다 (.../clang_1%3a3.0-6.2_armhf.deb에서) ...

Selecting previously unselected package libffi-dev:armhf.

libffi-dev:armhf 패키지를 푸는 중입니다 (.../libffi-dev_3.0.10-3+b3_armhf.deb에서) ...

Selecting previously unselected package llvm-3.0-runtime.

llvm-3.0-runtime 패키지를 푸는 중입니다 (.../llvm-3.0-runtime_3.0-10_armhf.deb에서) ...

Selecting previously unselected package llvm-3.0.

llvm-3.0 패키지를 푸는 중입니다 (.../llvm-3.0_3.0-10_armhf.deb에서) ...

Selecting previously unselected package llvm-3.0-dev.

llvm-3.0-dev 패키지를 푸는 중입니다 (.../llvm-3.0-dev_3.0-10_armhf.deb에서) ...

man-db에 대한 트리거를 처리하는 중입니다 ...

install-info에 대한 트리거를 처리하는 중입니다 ...

libllvm3.0:armhf (3.0-10) 설정하는 중입니다 ...

libclang-common-dev (1:3.0-6.2) 설정하는 중입니다 ...

clang (1:3.0-6.2) 설정하는 중입니다 ...

libffi-dev:armhf (3.0.10-3+b3) 설정하는 중입니다 ...

llvm-3.0-runtime (3.0-10) 설정하는 중입니다 ...

llvm-3.0 (3.0-10) 설정하는 중입니다 ...

llvm-3.0-dev (3.0-10) 설정하는 중입니다 ...


$ ls  -al /usr/bin/clang*
-rwxr-xr-x 1 root root 10524368 10월 18  2013 /usr/bin/clang
lrwxrwxrwx 1 root root        5 10월 18  2013 /usr/bin/clang++ -> clang

$ ls -al /usr/bin/scan-*
lrwxrwxrwx 1 root root 36 10월 18  2013 /usr/bin/scan-build -> ../share/clang/scan-build/scan-build
lrwxrwxrwx 1 root root 34 10월 18  2013 /usr/bin/scan-view -> ../share/clang/scan-view/scan-view


빌드 시간이나 바이너리 사이즈나.. clang이 우세한 듯...

$ time clang++ a.cpp

real    0m2.595s
user    0m2.350s
sys     0m0.210s

$ time g++ a.cpp

real    0m3.307s
user    0m2.490s
sys     0m0.230s

$ ls -al *.out
-rwxr-xr-x 1 pi pi 6033  8월  3 07:37 clang++.out
-rwxr-xr-x 1 pi pi 6492  8월  3 07:38 g++.out

$ strip *.out
$ ls -al *.out
-rwxr-xr-x 1 pi pi 3396  8월  3 07:39 clang++.out
-rwxr-xr-x 1 pi pi 3616  8월  3 07:39 g++.out



정적분석을 지원한다는데 잘 모르겠다.. 어떻게 쓰는지는 ㅠㅠ
clang static analyzer


$ scan-build clang++ a.cpp

scan-build: 'clang' executable not found in '/usr/share/clang/scan-build/bin'.

scan-build: Using 'clang' from path: /usr/bin/clang

scan-build: Removing directory '/tmp/scan-build-2015-08-03-1' because it contains no reports.


$ scan-build g++ a.cpp
scan-build: 'clang' executable not found in '/usr/share/clang/scan-build/bin'.
scan-build: Using 'clang' from path: /usr/bin/clang
scan-build: Removing directory '/tmp/scan-build-2015-08-03-1' because it contains no reports.

[링크 : http://web.cs.ucla.edu/~tianyi.zhang/tutorial.html]


$ clang --analyze a.cpp

[링크 : http://kthan.tistory.com/158]

'프로그램 사용 > clang' 카테고리의 다른 글

semgrep  (0) 2023.04.17
cppcheck 사용  (0) 2023.04.17
clang 으로 컴파일  (0) 2015.08.03
llvm / clang / cppcheck  (0) 2015.02.21
Posted by 구차니
embeded/raspberry pi2015. 8. 3. 08:38

기본적으로는 부팅시에만 가능하고

tvservice라는 3rd party 유틸을 통해 변경은 가능하나

출력 방향만 바꾸지 해상도까지 변경되는건 아니고 오버스캔 되는 등의 문제가 있으니

완전한 해결책이라고 하긴 힘들듯.


pi@delta ~ $ tvservice -c "PAL 4:3"; fbset -depth 8; fbset -depth 16

Powering on SDTV with explicit settings (mode:2 aspect:1)


pi@delta ~ $ tvservice -p; fbset -depth 8; fbset -depth 16

Powering on HDMI with preferred settings


[링크 : https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=38020]



pi@raspberrypi ~ $ tvservice

Usage: tvservice [OPTION]...

  -p, --preferred                   Power on HDMI with preferred settings

  -e, --explicit="GROUP MODE DRIVE" Power on HDMI with explicit GROUP (CEA, DMT, CEA_3D_SBS, CEA_3D_TB, CEA_3D_FP)

                                      MODE (see --modes) and DRIVE (HDMI, DVI)

  -t, --ntsc                        Use NTSC frequency for HDMI mode (e.g. 59.94Hz rather than 60Hz)

  -c, --sdtvon="MODE ASPECT"        Power on SDTV with MODE (PAL or NTSC) and ASPECT (4:3 14:9 or 16:9)

  -o, --off                         Power off the display

  -m, --modes=GROUP                 Get supported modes for GROUP (CEA, DMT)

  -M, --monitor                     Monitor HDMI events

  -s, --status                      Get HDMI status

  -a, --audio                       Get supported audio information

  -d, --dumpedid <filename>         Dump EDID information to file

  -j, --json                        Use JSON format for --modes output

  -n, --name                        Print the device ID from EDID

  -h, --help                        Print this information 


pi@raspberrypi ~ $ fbset --help
Linux Frame Buffer Device Configuration Version 2.1 (23/06/1999)
(C) Copyright 1995-1999 by Geert Uytterhoeven


Usage: fbset [options] [mode]

Valid options:
  General options:
    -h, --help         : display this usage information
    --test             : don't change, just test whether the mode is valid
    -s, --show         : display video mode settings
    -i, --info         : display all frame buffer information
    -v, --verbose      : verbose mode
    -V, --version      : print version information
    -x, --xfree86      : XFree86 compatibility mode
    -a, --all          : change all virtual consoles on this device
  Frame buffer special device nodes:
    -fb <device>       : processed frame buffer device
                         (default is /dev/fb0)
  Video mode database:
    -db <file>         : video mode database file
                         (default is /etc/fb.modes)
  Display geometry:
    -xres <value>      : horizontal resolution (in pixels)
    -yres <value>      : vertical resolution (in pixels)
    -vxres <value>     : virtual horizontal resolution (in pixels)
    -vyres <value>     : virtual vertical resolution (in pixels)
    -depth <value>     : display depth (in bits per pixel)
    -nonstd <value>    : select nonstandard video mode
    -g, --geometry ... : set all geometry parameters at once
    -match             : set virtual vertical resolution by virtual resolution
  Display timings:
    -pixclock <value>  : pixel clock (in picoseconds)
    -left <value>      : left margin (in pixels)
    -right <value>     : right margin (in pixels)
    -upper <value>     : upper margin (in pixel lines)
    -lower <value>     : lower margin (in pixel lines)
    -hslen <value>     : horizontal sync length (in pixels)
    -vslen <value>     : vertical sync length (in pixel lines)
    -t, --timings ...  : set all timing parameters at once
  Display flags:
    -accel <value>     : hardware text acceleration enable (false or true)
    -hsync <value>     : horizontal sync polarity (low or high)
    -vsync <value>     : vertical sync polarity (low or high)
    -csync <value>     : composite sync polarity (low or high)
    -gsync <value>     : synch on green (false or true)
    -extsync <value>   : external sync enable (false or true)
    -bcast <value>     : broadcast enable (false or true)
    -laced <value>     : interlace enable (false or true)
    -double <value>    : doublescan enable (false or true)
    -rgba <r,g,b,a>    : recommended length of color entries
    -grayscale <value> : grayscale enable (false or true)
  Display positioning:
    -move <direction>  : move the visible part (left, right, up or down)
    -step <value>      : step increment (in pixels or pixel lines)
                         (default is 8 horizontal, 2 vertical) 


Posted by 구차니

avt studio 4만 다뤄봐서.. 5 부터는 어떻게 되는진 모르겠지만

윈도우에서는  -D를 통해서 cpu 종류와 클럭을 넣어주었는데

리눅스에서는 컴파일러의 도움을 받아 mcu 종류를 넣어주면 알아서 확장해서 사용한다.

그래서 win-avr과 같은 종류별로 헤더를 찾는 수고로움이 더는 장점은 있지만

빌드 과정에서 설정하게 되어 있어서 모르면 더 복잡할지도..


-mmcu=architecture

Note that when only using -mmcu=architecture but no -mmcu=MCU type, including the file <avr/io.h> cannot work since it cannot decide which device's definitions to select.


Architecture Macros

avr5

AVR_ARCH=5

AVR_MEGA [5]

AVR_ENHANCED [5]

AVR_HAVE_JMP_CALL [4]

AVR_HAVE_MOVW [1]

AVR_HAVE_LPMX [1]

AVR_HAVE_MUL [1]

AVR_2_BYTE_PC [2]

avr51

AVR_ARCH=51

AVR_MEGA [5]

AVR_ENHANCED [5]

AVR_HAVE_JMP_CALL [4]

AVR_HAVE_MOVW [1]

AVR_HAVE_LPMX [1]

AVR_HAVE_MUL [1]

AVR_HAVE_RAMPZ [4]

AVR_HAVE_ELPM [4]

AVR_HAVE_ELPMX [4]

AVR_2_BYTE_PC [2]


-mmcu=MCU type

The following MCU types are currently understood by avr-gcc. The table matches them against the corresponding avr-gcc architecture name, and shows the preprocessor symbol declared by the -mmcu option. 


Architecture MCU name    Macro

avr5/avr51 [3] atmega128   __AVR_ATmega128__

[링크 : http://www.nongnu.org/avr-libc/user-manual/using_tools.html]





#define AVR 1

#define __AVR 1

#define __AVR_ARCH__ 5

#define __AVR_ATmega128__ 1

#define __AVR_ENHANCED__ 1

#define __AVR_MEGA__ 1

#define __AVR__ 1

#define __CHAR_BIT__ 8

#define __DBL_DENORM_MIN__ 1.40129846e-45

#define __DBL_DIG__ 6

#define __DBL_EPSILON__ 1.19209290e-7

#define __DBL_HAS_INFINITY__ 1

#define __DBL_HAS_QUIET_NAN__ 1

#define __DBL_MANT_DIG__ 24

#define __DBL_MAX_10_EXP__ 38

#define __DBL_MAX_EXP__ 128

#define __DBL_MAX__ 3.40282347e+38

#define __DBL_MIN_10_EXP__ (-37)

#define __DBL_MIN_EXP__ (-125)

#define __DBL_MIN__ 1.17549435e-38

#define __DECIMAL_DIG__ 9

#define __FINITE_MATH_ONLY__ 0

#define __FLT_DENORM_MIN__ 1.40129846e-45F

#define __FLT_DIG__ 6

#define __FLT_EPSILON__ 1.19209290e-7F

#define __FLT_EVAL_METHOD__ 0

#define __FLT_HAS_INFINITY__ 1

#define __FLT_HAS_QUIET_NAN__ 1

#define __FLT_MANT_DIG__ 24

#define __FLT_MAX_10_EXP__ 38

#define __FLT_MAX_EXP__ 128

#define __FLT_MAX__ 3.40282347e+38F

#define __FLT_MIN_10_EXP__ (-37)

#define __FLT_MIN_EXP__ (-125)

#define __FLT_MIN__ 1.17549435e-38F

#define __FLT_RADIX__ 2

#define __GNUC_MINOR__ 1

#define __GNUC_PATCHLEVEL__ 0

#define __GNUC__ 4

#define __GXX_ABI_VERSION 1002

#define __INTMAX_MAX__ 9223372036854775807LL

#define __INTMAX_TYPE__ long long int

#define __INT_MAX__ 32767

#define __LDBL_DENORM_MIN__ 1.40129846e-45L

#define __LDBL_DIG__ 6

#define __LDBL_EPSILON__ 1.19209290e-7L

#define __LDBL_HAS_INFINITY__ 1

#define __LDBL_HAS_QUIET_NAN__ 1

#define __LDBL_MANT_DIG__ 24

#define __LDBL_MAX_10_EXP__ 38

#define __LDBL_MAX_EXP__ 128

#define __LDBL_MAX__ 3.40282347e+38L

#define __LDBL_MIN_10_EXP__ (-37)

#define __LDBL_MIN_EXP__ (-125)

#define __LDBL_MIN__ 1.17549435e-38L

#define __LONG_LONG_MAX__ 9223372036854775807LL

#define __LONG_MAX__ 2147483647L

#define __NO_INLINE__ 1

#define __PTRDIFF_TYPE__ int

#define __REGISTER_PREFIX__ 

#define __SCHAR_MAX__ 127

#define __SHRT_MAX__ 32767

#define __SIZE_TYPE__ unsigned int

#define __STDC_HOSTED__ 1

#define __STDC__ 1

#define __UINTMAX_TYPE__ long long unsigned int

#define __USER_LABEL_PREFIX__ 

#define __USING_SJLJ_EXCEPTIONS__ 1

#define __VERSION__ "4.1.0"

#define __WCHAR_MAX__ 32767

#define __WCHAR_TYPE__ int

#define __WINT_TYPE__ unsigned int 

[링크 : http://www.avrfreaks.net/forum/how-does-mmcumcutarget-work]


'embeded > AVR (ATmega,ATtiny)' 카테고리의 다른 글

마우스 DIY 자료  (0) 2015.09.23
키보드 DIY 자료  (0) 2015.09.23
ubuntu 에서 AVR 컴파일하기  (0) 2015.07.30
USART UBRR error rate  (0) 2015.07.29
avr-libc 8bit AVR C++  (0) 2015.07.28
Posted by 구차니

앨범/달력 만들기

이것만은 꼭 하자 ㅠㅠ

쿠폰이 10월까지임 -_-a





그 외에 하면 좋겠는걸로는...

라즈베리 yocto project 및 밑바닥 부터 새로 올려보기

(일단은 리눅스 서버부터가... 하드를 사야하나..)


distcc 크로스 컴파일 시도


openGL 은.. 조금 천천히




'개소리 왈왈 > 직딩의 비애' 카테고리의 다른 글

경복궁 / 창덕궁 야간개장 예매 준비!  (0) 2015.08.05
국민은행 + KB 손해보험 -_-  (3) 2015.08.04
8월...  (0) 2015.08.01
아 빔프로젝터 사고 싶다.  (0) 2015.07.18
codility 잼나네..  (0) 2015.07.06
Posted by 구차니

한것 없이 시간만 잘가네...

언넝 기운차려서 일 열심히 해봐야지

이직의 준비가 될지

경력이 될지

돈 줄이 될지 모르니까

'개소리 왈왈 > 직딩의 비애' 카테고리의 다른 글

국민은행 + KB 손해보험 -_-  (3) 2015.08.04
8월 할일  (0) 2015.08.02
아 빔프로젝터 사고 싶다.  (0) 2015.07.18
codility 잼나네..  (0) 2015.07.06
자바의 앞날은..  (0) 2015.07.03
Posted by 구차니
개소리 왈왈/블로그2015. 7. 31. 21:13

35+11+6 = 51 ...

왜 씁쓸하지...?




'개소리 왈왈 > 블로그' 카테고리의 다른 글

싸이월드 새단장?? 서비스 종료?  (0) 2015.09.14
기분전환겸 스킨 변경  (0) 2015.09.04
출장 3일의 여파?  (2) 2015.07.16
출장여파 ㅋㅋㅋ  (0) 2015.07.12
댓글 알림은 있는데 댓글이 사라졌다?  (4) 2015.06.11
Posted by 구차니
embeded/AVR (ATmega,ATtiny)2015. 7. 30. 17:46

이러다가 조만간.. 메인 컴터를 리눅이로 갈아 탈듯 -_-

(게임도 안하는데 머...)



$ sudo apt-get install gcc-avr avr-libc avrdude 

[링크 : http://eiggerc.blogspot.kr/2013/03/ubuntu-avr.html]


올 ㅋ

pi@raspberrypi ~ $ avr-

avr-addr2line   avr-c++filt     avr-gcc-4.7.2   avr-gcov        avr-nm          avr-readelf

avr-ar          avr-cpp         avr-gcc-ar      avr-gprof       avr-objcopy     avr-size

avr-as          avr-g++         avr-gcc-nm      avr-ld          avr-objdump     avr-strings

avr-c++         avr-gcc         avr-gcc-ranlib  avr-man         avr-ranlib      avr-strip 


c++ 예제.파일 갯수가 여러개이니 왜 DDRA나 이런게 없냐고 하지 말자?

ATmega1284P.h

AvrBlinkenLed.cpp

IOPort.h

IOPort.cpp

Led.h

Led.cpp 

[링크 : http://10rem.net/.../gnu-cplusplus-blinkenled-part-1...]


project & makefile

$ avr-c++ -mmcu=atmega128 IOPort.cpp

[링크 : http://www.nongnu.org/avr-libc/user-manual/group__demo__project.html]


avr-gcc 기본 헤더 경로 확인

pi@raspberrypi ~/src/avr $ avr-gcc -print-file-name=include

/usr/lib/gcc/avr/4.7.2/include 

[링크 : http://ubuntuforums.org/showthread.php?t=1014673]


위의 예제는 직접 DDRA나 PORTA 등을 선언해서 쓴것이고

원래는 아래 경로의 io.h 를 끌어오면 알아서 mmcu에 맞춰서 하위 헤더를 끌어오게 된다.

pi@raspberrypi ~/src/avr $ sudo find / -name io.h

/usr/lib/avr/include/avr/io.h 


빌드는 성공! 굽는건 나중에 
pi@raspberrypi ~/src/avr $ make
avr-c++ -mmcu=atmega128 IOPort.cpp AvrBlinkenLed.cpp
In file included from IOPort.h:12:0,
                 from AvrBlinkenLed.cpp:10:
ATmega1284P.h:14:0: warning: "PINA" redefined [enabled by default]
In file included from /usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/io.h:150:0,
                 from AvrBlinkenLed.cpp:9:
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/iom128.h:135:0: note: this is the location of the previous definition
In file included from IOPort.h:12:0,
                 from AvrBlinkenLed.cpp:10:
ATmega1284P.h:15:0: warning: "DDRA" redefined [enabled by default]
In file included from /usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/io.h:150:0,
                 from AvrBlinkenLed.cpp:9:
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/iom128.h:138:0: note: this is the location of the previous definition
In file included from IOPort.h:12:0,
                 from AvrBlinkenLed.cpp:10:
ATmega1284P.h:16:0: warning: "PORTA" redefined [enabled by default]
In file included from /usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/io.h:150:0,
                 from AvrBlinkenLed.cpp:9:
/usr/lib/gcc/avr/4.7.2/../../../avr/include/avr/iom128.h:141:0: note: this is the location of the previous definition



2009/04/07 - [embeded/AVR (ATmega/ATtiny)] - linux에서 AVR 컴파일하기



'embeded > AVR (ATmega,ATtiny)' 카테고리의 다른 글

키보드 DIY 자료  (0) 2015.09.23
avr-gcc -mmcu 관련 작동 내용  (0) 2015.08.02
USART UBRR error rate  (0) 2015.07.29
avr-libc 8bit AVR C++  (0) 2015.07.28
avr twi / i2c 예제 및 풀업관련  (0) 2015.07.19
Posted by 구차니


yocto proejct - poky 다운로드

pi@raspberrypi ~/src $ git clone git://git.yoctoproject.org/poky yoctoProject

Cloning into 'yoctoProject'...

remote: Counting objects: 279679, done.

remote: Compressing objects: 100% (68614/68614), done.

Receiving objects: 100% (279679/279679), 112.68 MiB | 1.40 MiB/s, done.

Resolving deltas: 100% (205623/205623), done.

Checking out files: 100% (5101/5101), done. 



meta-raspberrypi layer 다운로드

pi@raspberrypi ~/src $ cd yoctoProject/

pi@raspberrypi ~/src/yoctoProject $ git clone git://git.yoctoproject.org/meta-raspberrypi

Cloning into 'meta-raspberrypi'...

remote: Counting objects: 1924, done.

remote: Compressing objects: 100% (906/906), done.

remote: Total 1924 (delta 841), reused 1924 (delta 841)

Receiving objects: 100% (1924/1924), 351.58 KiB | 255 KiB/s, done.

Resolving deltas: 100% (841/841), done. 


환경변수 및 라즈베리 파이 빌드할 경로 생성

pi@raspberrypi ~/src/yoctoProject $ source oe-init-build-env raspberryPiBuild/

You had no conf/local.conf file. This configuration file has therefore been

created for you with some default values. You may wish to edit it to use a

different MACHINE (target hardware) or enable parallel build options to take

advantage of multiple cores for example. See the file for more information as

common configuration options are commented.


You had no conf/bblayers.conf file. The configuration file has been created for

you with some default values. To add additional metadata layers into your

configuration please add entries to this file.


The Yocto Project has extensive documentation about OE including a reference

manual which can be found at:

    http://yoctoproject.org/documentation


For more information about OpenEmbedded see their website:

    http://www.openembedded.org/



### Shell environment set up for builds. ###


You can now run 'bitbake <target>'


Common targets are:

    core-image-minimal

    core-image-sato

    meta-toolchain

    adt-installer

    meta-ide-support


You can also run generated qemu images with a command like 'runqemu qemux86' 


라즈베리 파이 빌드를 위한 환경 설정 1

pi@raspberrypi ~/src/yoctoProject/raspberryPiBuild $ vim conf/local.conf

MACHINE ?= "raspberrypi" 


라즈베리 파이 빌드를 위한 환경 설정 2

pi@raspberrypi ~/src/yoctoProject/raspberryPiBuild $ vim conf/bblayers.conf

# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf

# changes incompatibly

LCONF_VERSION = "6"


BBPATH = "${TOPDIR}"

BBFILES ?= ""


BBLAYERS ?= " \

  /home/pi/src/yoctoProject/meta \

  /home/pi/src/yoctoProject/meta-yocto \

  /home/pi/src/yoctoProject/meta-yocto-bsp \

  /home/pi/src/yoctoProject/meta-raspberrypi \

  "

BBLAYERS_NON_REMOVABLE ?= " \

  /home/pi/src/yoctoProject/meta \

  /home/pi/src/yoctoProject/meta-yocto \

  "


빌드를 위한 패키지 설치(라즈비안에서 한 120메가 다운로드 / 500메가 용량 필요)

pi@raspberrypi ~/src/yoctoProject/raspberryPiBuild $ sudo apt-get install sed wget cvs subversion git-core coreutils unzip texi2html texinfo libsdl1.2-dev docbook-utils gawk python-pysqlite2 diffstat help2man make gcc build-essential g++ desktop-file-utils chrpath libgl1-mesa-dev libglu1-mesa-dev mercurial autoconf automake groff libtool xterm


빌드 시작

pi@raspberrypi ~/src/yoctoProject/raspberryPiBuild $ bitbake core-sato-image


리부팅후 환경변수 재설정

pi@raspberrypi ~/src/yoctoProject $ source oe-init-build-env 


끄응.. 왜 안되지? 라즈베리에서 라즈베리를 빌드하려고 해서 그런가? ㅋㅋㅋ

pi@raspberrypi ~/src/yoctoProject/raspberryPiBuild $ bitbake core-sato-image

WARNING: Host distribution "Raspbian-GNU-Linux-7" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.

ERROR: Unable to determine endianness for architecture 'armv6l' | ETA:  --:--:--

ERROR: Please add your architecture to siteinfo.bbclass

ERROR: Failed to parse recipe: /home/pi/src/yoctoProject/meta/recipes-core/coreutils/coreutils_8.24.bb


Summary: There was 1 WARNING message shown.

Summary: There were 3 ERROR messages shown, returning a non-zero exit code.



---

pi@raspberrypi ~/src/yoctoProject $ ls -al

합계 92

drwxr-xr-x 12 pi pi  4096  7월 30 06:33 .

drwxr-xr-x 10 pi pi  4096  7월 30 06:29 ..

drwxr-xr-x  8 pi pi  4096  7월 30 06:33 .git

-rw-r--r--  1 pi pi   346  7월 30 06:32 .gitignore

-rw-r--r--  1 pi pi    66  7월 30 06:32 .templateconf

-rw-r--r--  1 pi pi   515  7월 30 06:32 LICENSE

-rw-r--r--  1 pi pi  2458  7월 30 06:32 README

-rw-r--r--  1 pi pi 19318  7월 30 06:32 README.hardware

drwxr-xr-x  6 pi pi  4096  7월 30 06:32 bitbake

drwxr-xr-x 13 pi pi  4096  7월 30 06:32 documentation

drwxr-xr-x 21 pi pi  4096  7월 30 06:32 meta

drwxr-xr-x 13 pi pi  4096  7월 30 06:33 meta-raspberrypi

drwxr-xr-x  5 pi pi  4096  7월 30 06:32 meta-selftest

drwxr-xr-x  7 pi pi  4096  7월 30 06:32 meta-skeleton

drwxr-xr-x  5 pi pi  4096  7월 30 06:32 meta-yocto

drwxr-xr-x  8 pi pi  4096  7월 30 06:32 meta-yocto-bsp

-rwxr-xr-x  1 pi pi  2002  7월 30 06:32 oe-init-build-env

-rwxr-xr-x  1 pi pi  2432  7월 30 06:32 oe-init-build-env-memres

drwxr-xr-x  8 pi pi  4096  7월 30 06:32 scripts


pi@raspberrypi ~/src $ du -h yoctoProject/

178M    yoctoProject/



[링크 : http://ric96.blogspot.in/2014/09/yocto-for-raspberry-pi-build-guide.html]

'프로그램 사용 > yocto project' 카테고리의 다른 글

imx8 yocto  (0) 2023.08.28
imx8 yocto build on ubuntu 22.04  (0) 2023.02.10
yocto project 구조  (0) 2015.07.29
라즈베리 파이 2 yocto 프로젝트?  (0) 2015.06.08
rpi in yocto project  (0) 2015.04.29
Posted by 구차니