IT 취미생활.  
Front Page
Tag | Location | Media | Guestbook | Admin   
 
'2011/09'에 해당하는 글(5)
2011.09.14   Finding Memory Leaks Using the CRT Library
2011.09.05   Program Arduino with AVR-GCC
2011.09.01   새로운 장난감....
2011.09.01   ATMEGA328P-PU
2011.09.01   Arduino uno 간단한 보드 설명.


Finding Memory Leaks Using the CRT Library
Visual Studio를 사용시 아래 링크를 참조하면 memory leak을 쉽게 잡을 수 있습니다.

http://msdn.microsoft.com/en-us/library/x98tx3cf.aspx


Tool을 이용하지 못 하는 경우에는,

malloc이나 free가 호출 될때 블럭 사이즈와 counter를 계산하여 free가 되지 않은 곳에
위치를 잡아두고, 프로그램이 끝날 때 출력하면 memory leak을 쉽게 잡을 수 있습니다.


static void *malloc_dbg(size)
{
    totalMemoryUsage += size;
    return malloc(size);
}

static void free_dbg(void *dst, int size)
{
    totalMemoryUsage -= size;
    free(dst);
}

void reportMemoryReport()
{
     if (!totalMemoryUsage) {
         return;
     }
     // memory leak detected! 
     //
}

뭐 대충 이런거고요.

좀도 지속적으로 써먹을꺼면, malloc 할때 #define로 malloc_dbg를 좀더 다듬어 주면 되겠네요.
malloc 위치라던지 이런걸 받아 테이블에 기억해두고 나중에 해제가 되면 테이블에서 삭제.
추후 리포트에서 memory 가 해제되지 않을을 때 출력.


기초적인 내용을 그냥 끄적 해봤습니다.

하나더 magic code를 malloc시에 넣어 buffer overflow가 발생, 메모리 경계가 넘어가는걸 체크 해보는 방법도 좋습니다.


Program Arduino with AVR-GCC


이 페이지는 Arduino IDE를 사용하지 않고  AVR-GCC toolchain을 이용하여 직접 C에서 AVR 프로그래밍을 하는 것을 보여주는 기사이다.  여기서는 bootLoader 및 setup fuse bits를 설정하는 것 까지 다룰 것이다.

아래 링크 참조.

http://www.javiervalcarce.eu/wiki/Program_Arduino_with_AVR-GCC


아무래도 Arduino를 위한 IDE를 사용하지 않고  C로만 빌드하는게, 일반 프로그래머 들에게는 더 욱 친숙한 환경이다.

Javier Valcarce's Personal Website에서 직접 C를 이용 할때 의장점을 아래와 같이 말하고 있다.

  • C lets a more accurate time and execution control. No hidden code, "What You Type Is What Is Executed" (tm)
  • C lets simple and direct access to hardware and interrupts
  • C lets you make ports to other MCUs apart than Arduino (ATmega168)

Port 번호는 가지고 있는 보드별로 다르기 때문에 data sheet를 참고 할 것.



새로운 장난감....




이걸 보고 있으면 뭔가 센서 들을 연결해서 생활 가전을 만들 고 싶어지네요.



ATMEGA328P-PU

Atmel ATmega328 8-Bit AVR® MCUs

Atmel ATmega328 8-bit AVR® microcontrollers are high-performance RISC-based devices that combine 32KB ISP Flash memory with read-while-write capabilities, 1KB EEPROM, 2KB SRAM, 23 general-purpose I/O lines, 32 general-purpose working registers, serial programmable USART, and more. Atmel ATmega328 MCUs execute powerful instructions in a single clock cycle, allowing the device to achieve throughputs approaching 1 MIPS per MHz while balancing power consumption and processing speed. These Atmel MCUs are designed for use in industrial automation and home and building automation.

Features
  • High Performance, Low Power AVR® 8-Bit Microcontroller
  • Advanced RISC Architecture
    • 131 Powerful Instructions
    • Up to 20 MIPS Throughput at 20MHz
    • On-chip 2-cycle Multiplier
  • Pin Count: 28/32
  • Max I/O Pins: 23
  • SPI: 2
  • UART: 1
  • ADC: 8 channels, 10-bit resolution
  • Analog Comparators: 1
  • Flash (Kbytes): 32
  • EEPROM (Kbytes): 1
  • SRAM (Kbytes): 2
  • Temp. Range: -40 to 85 °C
Applications
  • Home and Building Automation
  • Comfort and Control
  • Industrial Automation
  • Sensors

 






Arduino uno 간단한 보드 설명.




출처 : http://cdn.makezine.com/make/arduino/Arduino-callouts1.jpg

실제 ATmega328에 대한 data 쉬트가 필요하겠따.



BLOG main image
취미생활
 Notice
 Category
분류 전체보기 (191)
매일매일갱생 (83)
서버개발 (1)
임베디드개발 (12)
Programming (80)
Personal Projects (6)
유용한 프로그램 (0)
 TAGS
spam mail DVB DVB-T Wince5.0 debugging ISDB-T MP3 출장 Windows Mobile6.0 서태지 군대 영어 이메일 벨소리 변경 퇴사 Debug english email M480 티스토리초대 DirectShow Brazil isdbt 알고리즘 It Algorithm Linux Error Case 음식 project 티스토리 초대장 warning C 미라지폰 C++ Java Dshow VC++ 개발자 English 1seg
 Calendar
«   2011/09   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30
 Recent Entries
 Recent Comments
 Recent Trackbacks
 Archive
 Link Site
zextor
괴짜 프로그래머의 일상사~@@
Gag & Peace, and more..
Kazakhstan Almaty.......
Min-A
Sadgarret
Steve Yoon's log
가슴 뛰는 삶을 살아라
오스틴 파워
GUI sin
melanie parker_Lady
제레미의 TV 2.0 이야기..
 Visitor Statistics
Total :
Today :
Yesterday :
rss