Nios II ソフトウェア開発ハンドブック Version 1.2 第4章. HALを使用したプログラムの開発 ver.1.2

Similar documents
Nios II ソフトウェア開発ハンドブック Version 1.2 セクション IV. 付録 

Nios II ソフトウェア開発ハンドブック Version 1.2 第5章. HAL用デバイス・ドライバの開発 ver.1.1

Nios II IDE によるソフトウェア開発 - セクション 1

Quartus II ハンドブック Volume 5、セクションIV. マルチプロセッサの調整

1 C STL(1) C C C libc C C C++ STL(Standard Template Library ) libc libc C++ C STL libc STL iostream Algorithm libc STL string vector l

slide4.pptx

Nios® II HAL API を使用したソフトウェア・サンプル集 「Modular Scatter-Gather DMA Core」

A/B (2018/10/19) Ver kurino/2018/soft/soft.html A/B

: CR (0x0d) LF (0x0a) line separator CR Mac LF UNIX CR+LF MS-DOS WINDOWS Japan Advanced Institute of Science and Technology

Nios II ソフトウェア開発ハンドブック Version 1.2 第6章. 例外処理 ver.1.2


‚æ4›ñ

mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( )

joho07-1.ppt

1.ppt

ファイル入出力と プロセス間通信 \(1\)

卒 業 研 究 報 告.PDF

ex14.dvi

II ( ) prog8-1.c s1542h017%./prog8-1 1 => 35 Hiroshi 2 => 23 Koji 3 => 67 Satoshi 4 => 87 Junko 5 => 64 Ichiro 6 => 89 Mari 7 => 73 D

tutorial_lc.dvi

Original : Hello World! (0x0xbfab85e0) Copy : Hello World! (0x0x804a050) fgets mstrcpy malloc mstrcpy (main ) mstrcpy malloc free fgets stream 1 ( \n

スライド タイトルなし

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() 2 double *a[ ]; double 1 malloc() dou

Nios II IDE によるソフトウェア開発 セクション 2

超初心者用

:30 12:00 I. I VI II. III. IV. a d V. VI

Nios II ハードウェア・チュートリアル

I. Backus-Naur BNF : N N 0 N N N N N N 0, 1 BNF N N 0 11 (parse tree) 11 (1) (2) (3) (4) II. 0(0 101)* (

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * *

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() malloc 2 #include <stdio.h> #include

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v

FreeBSD 1

プロセッサ・アーキテクチャ

r08.dvi

ohp08.dvi

double float

Microsoft PowerPoint - kougi9.ppt

Microsoft Word - C.....u.K...doc

main main Makefile Makefile C.5 Makefile Makefile Makefile A Mech (TA ) 1. Web ( iku

lexex.dvi

計算機プログラミング

untitled

Minimum C Minimum C Minimum C BNF T okenseq W hite Any D

para02-2.dvi

新版明解C言語 実践編

(K&R 2.9) ~, &,, >>, << 2. (K&R 5.7) 3. (K&R 5.9) 4. (K&R 5.10) (argc argv atoi(), atof() ) 5. (K&R 7.5) (K&R 7.6) - FILE, stdin, stdout, std

I 2 tutimura/ I 2 p.1/??

Apache Web Server 2 Compaq ActiveAnswers Deskpro Compaq Insight Manager Fastart Systempro Systempro/LT ProLiant ROMPaq Qvision SmartStart NetFlex Quic

新・明解C言語 実践編

memo

1 $ cat aboutipa 2 IPA is a Japanese quasi-government 3 organization established in accor- 4 dance with The Law for Information 5 Processing Technolog

Microsoft PowerPoint - CproNt11.ppt [互換モード]

C B

tuat2.dvi

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU

Nios II 簡易チュートリアル

:30 12:00 I. I VI II. III. IV. a d V. VI

tuat1.dvi

program.dvi

Cプログラミング1(再) 第2回

C

Taro-ファイル処理(公開版).jtd

ディジタル信号処理

slide5.pptx

NI P1200 Release Notes Cover

IP L09( Tue) : Time-stamp: Tue 14:52 JST hig TCP/IP. IP,,,. ( ) L09 IP (2017) 1 / 28

全体ロードマップ インターネット電話 音の符号化 ( 信号処理 ) 今日 音の録音 再生 ネットワーク ( ソケット ) プログラミング ファイル入出力 インターネットの基礎 C プログラミング基礎

Microsoft PowerPoint - kougi8.ppt

WinHPC ppt

新・明解C言語 ポインタ完全攻略

untitled

[ 1] 1 Hello World!! 1 #include <s t d i o. h> 2 3 int main ( ) { 4 5 p r i n t f ( H e l l o World!! \ n ) ; 6 7 return 0 ; 8 } 1:

C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. このサンプルページの内容は, 新装版 1 刷発行時のものです.

file"a" file"b" fp = fopen("a", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose(fp); fp = fopen("b", "r"); while(fgets(line, BUFSIZ, fp)) {... fclose

情報処理演習 B8クラス

02: 変数と標準入出力

r07.dvi

void hash1_init(int *array) int i; for (i = 0; i < HASHSIZE; i++) array[i] = EMPTY; /* i EMPTY */ void hash1_insert(int *array, int n) if (n < 0 n >=

エラー処理・分割コンパイル・コマンドライン引数

ohp07.dvi

C言語入門

II 3 yacc (2) 2005 : Yacc 0 ~nakai/ipp2 1 C main main 1 NULL NULL for 2 (a) Yacc 2 (b) 2 3 y

RX600 & RX200シリーズ アプリケーションノート RX用仮想EEPROM

untitled

: Nonblocking I/O readpartial read EOF Solaris FILE 256 ungetc SEGV errno stdio considered harmful p.

memo

CM-3G 周辺モジュール拡張技術文書 MS5607センサ(温度、気圧)


02: 変数と標準入出力

数値計算

thesis.dvi

Baud Rate 9600 Parity NONE Number of Data Bits 8 Number of Stop Bits 1 Flow Control NONE 1 RS232C 200mm 2,000mm DIMM ( ) Telescope East/West LX200 * 1

Microsoft Word - 06

mbed_library_study_meeting_v1.0.key

Microsoft Word - Cプログラミング演習(10)

13 I/O

1 return main() { main main C 1 戻り値の型 関数名 引数 関数ブロックをあらわす中括弧 main() 関数の定義 int main(void){ printf("hello World!!\n"); return 0; 戻り値 1: main() 2.2 C main

ファイルシステム

PowerPoint プレゼンテーション

Taro-リストⅢ(公開版).jtd

Transcription:

4. HAL NII52004-1.2 HAL Hardware Abstraction Layer HAL API Nios II HAL ANSI C HAL API ANSI C HAL HAL API ANSI C ANSI C HAL HAL printf() scanf() ANSI C I/O HAL API RTOS ANSI C Nios II IDE HAL Nios II IDE HAL Nios II IDE Altera Corporation 4 1 2004 12 Preliminary

Nios II IDE 4-1 HAL Nios II 4-1. Nios II IDE HAL.c.h.s HAL HAL Nios II IDE Nios II IDE SOPC Builder Nios II.ptf SOPC Builder HAL 4-1 2 Nios II IDE 1 HAL HAL Nios II SOPC Builder.ptf 4 2 Altera Corporation Nios II 2004 12

HAL SOPC Builder.ptf Nios II IDE HAL HAL HAL system.h system.h HAL system.h Nios II system.h C system.h? system.h IRQ system.h system.h HAL Nios II IDE system.h Nios II IDE HAL Nios II IDE Altera Corporation 4 3 2004 12 Nios II

HAL system.h system.h /* * sys_clk_timer configuration * */ #define SYS_CLK_TIMER_NAME "/dev/sys_clk_timer" #define SYS_CLK_TIMER_TYPE "altera_avalon_timer" #define SYS_CLK_TIMER_BASE 0x00920800 #define SYS_CLK_TIMER_IRQ 0 #define SYS_CLK_TIMER_ALWAYS_RUN 0 #define SYS_CLK_TIMER_FIXED_PERIOD 0 /* * jtag_uart configuration * */ #define JTAG_UART_NAME "/dev/jtag_uart" #define JTAG_UART_TYPE "altera_avalon_jtag_uart" #define JTAG_UART_BASE 0x00920820 #define JTAG_UART_IRQ 1 HAL Nios II ANSI C HAL ANSI C alt_type.h HAL 4 1 HAL 4 1. HAL alt_8 alt_u8 alt_16 alt_u16 alt_32 alt_u32 8 8 16 16 32 32 4 4 Altera Corporation Nios II 2004 12

HAL 4 2 GNU Toolchain 4 2. GNU Toolchain char short long int 8 16 32 32 UNIX HAL API UNIX UNIX Nios II HAL HAL ANSI C stdio.h C UNIX _exit() close() fstat() getpid() gettimeofday() ioctl() isatty() kill() lseek() open() read() sbrk() settimeofday() stat() usleep() wait() write() I/O 4 6 Altera Corporation 4 5 2004 12 Nios II

10 1 HAL API HAL newlib C I/O fopen() fclose() fread() HAL UNIX I/O HAL UNIX close() fstat() ioctl() isatty() lseek() open() read() stat() write() 10 1 HAL API HAL zip /mount/zipfs() /mount/zipfs()/myfile fopen() zipfs HAL system.h /dev/ SOPC Builder SOPC Builder UART uart1 system.h /dev/uart1 4 6 Altera Corporation Nios II 2004 12

HAL HAL zip rozipfs #include <stdio.h> #include <stddef.h> #include <stdlib.h> #define BUF_SIZE (10) int main(void) FILE* fp; char buffer[buf_size]; fp = fopen ( /mount/rozipfs/test, r ); if (fp == NULL) printf ( Cannot open file.\n ); exit (1); fread (buffer, BUF_SIZE, 1, fp); fclose (fp); return 0; 10 1 HAL API UART Universal Asynchronous Receiver/Transmitter HAL file.h ANSI C HAL stdio.h I/O Altera Corporation 4 7 2004 12 Nios II

I/O stdin stdoutstderr HAL stdin stdout stderr printf() perror() Nios II IDE Nios II IDE Hello World Nios II IDE stdout Hello World #include <stdio.h> int main () printf ( Hello world! ); return 0; UNIX API unistd.h STDIN_FILENO STDOUT_FILENO STDERR_FILENO stdin stdout stderr stdin stdout stderr uart1 UART UART #include <stdio.h> #include <string.h> int main (void) char* msg = hello world ; FILE* fp; 4 8 Altera Corporation Nios II 2004 12

HAL fp = fopen ( /dev/uart1, w ); if (fp) fprintf(fp, %s,msg); fclose (fp); return 0; C++ HAL C++ C++ API /dev/null /dev/null /dev/null /dev/null I/O HAL C I/O zip I/O /mnt/rozipfs fopen( /mnt/rozipfs/myfile, r ) fopen() fread() file.h C I/O 10 1 HAL API Altera Corporation 4 9 2004 12 Nios II

HAL Nios II HAL API 2 1 1 HAL UNIX gettimeofday() settimeofday() times() HAL API sys/alt_alarm.h sys/alt_timestamp.h 10 1 HAL API HAL HAL Nios II IDE Nios II IDE HAL Nios II HAL 4 10 Altera Corporation Nios II 2004 12

HAL alt_nticks() / alt_ticks_per_second() HAL UNIX gettimeofday() settimeofday() times() times.h HAL alt_alarm_start() int alt_alarm_start (alt_alarm* alarm, alt_u32 nticks, alt_u32 (*callback) (void* context), void* context); callback nticks context callback alarm alt_alarm_start() callback alt_alarm_stop() 6 1 Altera Corporation 4 11 2004 12 Nios II

1 #include <stddef.h> #include <stdio.h> #include sys/alt_alarm.h #include alt_types.h /* * */ alt_u32 my_alarm_callback (void* context) /* 1 */ return alt_ticks_per_second();... /* alt_alarm */ static alt_alarm alarm;... if (alt_alarm_start (&alarm, alt_ticks_per_second(), my_alarm_callback, NULL) < 0) printf ( No system clock available\n ); HAL HAL HAL 1 alt_timestamp_start() alt_timestamp() Nios II IDE 4 12 Altera Corporation Nios II 2004 12

HAL alt_timestamp_start() alt_timestamp() alt_timestamp_start() 2 32 1 alt_timestamp_freq() Nios II alt_timestamp.h #include <stdio.h> #include sys/alt_timestamp.h #include alt_types.h int main (void) alt_u32 time1; alt_u32 time2; alt_u32 time3; if (alt_timestamp_start() < 0) printf ( No timestamp device available\n ); else time1 = alt_timestamp(); func1(); /* */ time2 = alt_timestamp(); func1(); /* 2 */ time3 = alt_timestamp(); printf ( time in func1 = %u ticks\n, (unsigned int) (time2 time1)); printf ( time in func2 = %u ticks\n, (unsigned int) (time3 time2)); printf ( Number of ticks per second = %u\n, (unsigned int)alt_timestamp_freq()); return 0; Altera Corporation 4 13 2004 12 Nios II

HAL HAL API HAL API HAL API EPCS HAL API HAL API 2 API API API sys/alt_flash.h 10 1 HAL API 4 14 Altera Corporation Nios II 2004 12

HAL alt_flash_open_dev() alt_write_flash() alt_read_flash() alt_flash_close_dev() 4 16 API 1 alt_flash_open_dev() system.h alt_write_flash() int alt_write_flash(alt_flash_fd* fd, int offset, const void* src_addr, int length ) fd offset src_addr length alt_read_flash() int alt_read_flash( alt_flash_fd* fd, int offset, void* dest_addr, int length ) fd offset dest_addr length alt_read_flash() alt_flash_close_dev() void alt_flash_close_dev(alt_flash_fd* fd ) Altera Corporation 4 15 2004 12 Nios II

system.h /dev/ext_flash API API #include <stdio.h> #include <string.h> #include sys/alt_flash.h #define BUF_SIZE1024 int main () alt_flash_fd* fd; int ret_code; char source[buf_size]; char dest[buf_size]; /* 0xAA */ memset(source, 0xa, BUF_SIZE); fd = alt_flash_open_dev( /dev/ext_flash ); if (fd) ret_code = alt_write_flash(fd, 0, source, BUF_SIZE); if (!ret_code) ret_code = alt_read_flash(fd, 0, dest, BUF_SIZE); if (!ret_code) /* * * 0xa * dest */ alt_flash_close_dev(fd); else printf( Can t open flash device\n ); return 0; 4 16 Altera Corporation Nios II 2004 12

HAL alt_write_flash() 4 18 4 3 4 3 2 4K 8K 0xAA 5K 0x0000 0xBB2 K 0x1400 t(2) 0xAA 5 K 0xFF2 2 t(3) 0xAA 4 K 0xFF 4 K 2 t(4) 0x1000 2 K 0xFF 4 3. t(0) t(1) t(2) t(3) t(4) 1 1 2 1 2 0x0000 1?? FF AA AA AA 0x0400 1?? FF AA AA AA 0x0800 1?? FF AA AA AA 0x0C00 1?? FF AA AA AA 0x1000 2?? FF AA FF FF (1) 0x1400 2?? FF FF FF BB 0x1800 2?? FF FF FF BB 0x1C00 2?? FF FF FF FF 4 3 (1) 2 FF Altera Corporation 4 17 2004 12 Nios II

3 alt_get_flash_info() alt_erase_flash_block() alt_write_flash_block() 1 1 1 0 0 1 alt_get_flash_info() int alt_get_flash_info( alt_flash_fd* fd, flash_region** info, int* number_of_regions) number_of_regions info 1 flash_region flash_region sys/alt_flash_types.h typedef typedef struct flash_region int offset;/* */ int region_size;/* */ int number_of_blocks;/* */ int block_size;/* */ flash_region; 4 18 Altera Corporation Nios II 2004 12

HAL alt_get_flash_info() alt_erase_flash() int alt_erase_flash_block( alt_flash_fd* fd, int offset, int length) fd offset length alt_write_flash_block() 1 int alt_write_flash_block( alt_flash_fd* fd, int block_offset, int data_offset, const void *data, int length) fd block_offset data length data_offset API #include <string.h> #include "sys/alt_flash.h" #define BUF_SIZE 100 int main (void) flash_region* regions; alt_flash_fd* fd; int number_of_regions; int ret_code; char write_data[buf_size]; Altera Corporation 4 19 2004 12 Nios II

DMA /* write_data 0xa */ memset(write_data, 0xA, BUF_SIZE); fd = alt_flash_open_dev(ext_flash_name); if (fd) ret_code = alt_get_flash_info(fd, &regions, &number_of_regions); if (number_of_regions && (regions->offset == 0)) /* 1 */ ret_code = alt_erase_flash_block(fd, regions->offset, regions->block_size); if (ret_code) /* * write_data BUF_SIZE 100 * 1 */ ret_code = alt_write_flash_block( fd, regions->offset, regions->offset+0x100, write_data, BUF_SIZE); return 0; DMA HAL DMA Direct Memory Access HAL DMA DMA 2 HAL 2 2 4 20 Altera Corporation Nios II 2004 12

HAL 4-2 DMA 3 DMA DMA 4-2. DMA 3 1. DMA Recieve Channel 2. DMA 3. DMA DMA DMA API sys/alt_dma.h 10 1 HAL API DMA 7 1 DMA DMA DMA alt_dma_txchan_open() system.h 1 Altera Corporation 4 21 2004 12 Nios II

DMA DMA dma_0 DMA #include <stddef.h> #include sys/alt_dma.h int main (void) alt_dma_txchan tx; tx = alt_dma_txchan_open ( /dev/dma_0 ); if (tx == NULL) /* */ else /* */ return 0; alt_dma_txchan_send() typedef void (alt_txchan_done)(void* handle); int alt_dma_txchan_send (alt_dma_txchan dma, const void* from, alt_u32 length, alt_txchan_done* done, void* handle); alt_dma_txchan_send()dma length from DMA handle done DMA 2 alt_dma_txchan_space() alt_dma_txchan_ioctl() alt_dma_txchan_space() alt_dma_txchan_ioctl() 4 22 Altera Corporation Nios II 2004 12

HAL DMA DMA DMA DMA alt_dma_rxchan_open() alt_dma_rxchan_prepare() alt_dma_rxchan_prepare() typedef void (alt_rxchan_done)(void* handle, void* data); int alt_dma_rxchan_prepare (alt_dma_rxchan dma, void* data, alt_u32 length, alt_rxchan_done* done, void* handle); dma legthdata DMA handle done DMA 2 alt_dma_rxchan_depth() alt_dma_rxchan_ioctl() alt_dma_rxchan_depth() alt_dma_rxchan_ioctl() DMA main() DMA #include <stdio.h> #include <stddef.h> #include <stdlib.h> #include sys/alt_dma.h #include alt_types.h /* */ volatile int dma_complete = 0; /* */ void dma_done (void* handle, void* data) Altera Corporation 4 23 2004 12 Nios II

DMA dma_complete = 1; int main (void) alt_u8 buffer[1024]; alt_dma_rxchan rx; /* */ if ((rx = alt_dma_rxchan_open ( /dev/dma_0 )) == NULL) printf ( Error:failed to open device\n ); exit (1); else /* */ if (alt_dma_rxchan_prepare (rx, buffer, 1024, dma_done, NULL) < 0) printf ( Error:failed to post receive request\n ); exit (1); /* */ while (!dma_complete); printf ( Transaction complete\n ); alt_dma_rxchan_close (rx); return 0; DMA DMA DMA DMA #include <stdio.h> #include <stdlib.h> #include "sys/alt_dma.h" #include "system.h" static volatile int rx_done = 0; /* * * */ 4 24 Altera Corporation Nios II 2004 12

HAL static void done (void* handle, void* data) rx_done++; /* * */ int main (int argc, char* argv[], char* envp[]) int rc; alt_dma_txchan txchan; alt_dma_rxchan rxchan; void* tx_data = (void*) 0x901000; /* */ void* rx_buffer = (void*) 0x902000; /* rx */ /* */ if ((txchan = alt_dma_txchan_open("/dev/dma_0")) == NULL) printf ("Failed to open transmit channel\n"); exit (1); /* */ if ((rxchan = alt_dma_rxchan_open("/dev/dma_0")) == NULL) printf ("Failed to open receive channel\n"); exit (1); /* */ if ((rc = alt_dma_txchan_send (txchan, tx_data, 128, NULL, NULL)) < 0) printf ("Failed to post transmit request, reason = %i\n", rc); exit (1); /* */ if ((rc = alt_dma_rxchan_prepare (rxchan, rx_buffer, 128, done, NULL)) < 0) Altera Corporation 4 25 2004 12 Nios II

printf ("Failed to post read request, reason = %i\n", rc); exit (1); /* */ while (!rx_done); printf ("Transfer successful!\n"); return 0; HAL Nios II HAL nios2-elf-gcc -O3 compiler 2 2 HAL Nios II IDE HAL Use Small Footprint Drivers HAL DALT_USE_SMALL_DRIVERS 4 26 Altera Corporation Nios II 2004 12

HAL 4 4 Nios II 4 4. P. UART JTAG UART LCD IRQ IRQ ALT_MAX_FD Nios II IDE 32 10 ALT_MAX_FD /dev/null null /dev/null printf() HAL stdin stdout stderr null stdin stdin stdout stderr Nios II IDE Altera Corporation 4 27 2004 12 Nios II

ANSI C UNIX I/O UNIX I/O ANSI C I/O I/O ANSI C API UNIX I/O API 4 5 UNIX Newlib C ANSI C HAL newlib newlib ANSI C newlib newlib Nios II IDE nios2-elf-gcc -msmallc newlib C Nios II newlib Windows > Altera > Nios II Development Kit > Nios II Documentation 4 28 Altera Corporation Nios II 2004 12

HAL 4 5 newlib C 4 5. newlib C printf() %f %g scanf() FILE * / stdout stderr stdin FILE * stdio.h asprintf() fiprintf() fprintf() iprintf() printf() siprintf() snprintf() sprintf() vasprintf() vfiprintf() vfprintf() vprintf() vsnprintf() vsprintf() fscanf() scanf() sscanf() vfscanf() vscanf() vsscanf() fseek() ftell() fopen() fclose() fdopen() fcloseall() fileno() stdio.h C++ setbuf() setvbuf() setlocale() localeconv() Altera Corporation 4 29 2004 12 Nios II

Nios II IDE HAL HAL FPGA DALT_NO_CFI_FLASH HAL 4 31 _exit() HAL exit() exit() C I/O atexit() exit() main() exit() _exit() Nios II IDE -Dexit=_exit 4 30 Altera Corporation Nios II 2004 12

HAL HAL C ALT_NO_INSTRUCTION_EMULATION / / / -mno-hw-mul mhw-div main() alt_main() main() alt_main() ANSI C main() main() HAL HAL Nios II HAL 1 Altera Corporation 4 31 2004 12 Nios II

ANSI C Nios II alt_main() alt_main() stdout printf() HAL Nios II 4 26 HAL Nios II IDE Nios II Nios II IDE HAL HAL bss_start bss_end BSS BSS.rwdata.rodata/RAM 4 37 alt_main() 4 32 Altera Corporation Nios II 2004 12

HAL alt_main() ALT_OS_INIT() OS HAL HAL alt_fd_list_lock semaphore alt_sys_init() Nios II IDE HAL alt_sys_init.c C I/O stdin stdout stderr _do_ctors() C++ C++ main () exit()main() exit() Nios II alt_main.c Nios II IDE alt_main() HAL alt_main() alt_main() void alt_main (void) Altera Corporation 4 33 2004 12 Nios II

HAL 1 alt_sys_init.c alt_sys_init() 5 1 HAL HAL HAL HAL Nios II IDE system.h on_chip_memory.on_chip_memory Nios II 32 4 34 Altera Corporation Nios II 2004 12

HAL 4-3 0x0 SOPC Builder 0x20 4-3. HAL on_chip_ram 0x0.on_chip_ram 0x0 +0x10 sdram.reset.sdram Nios II RAM RAM Altera Corporation 4 35 2004 12 Nios II

.reset 3.text.rodata.rwdata.text.rodata.rwdata Nios II IDE Nios II IDE C C++ section.on_chip_memory foo.sdram bar() C /* */ int foo attribute ((section (".on_chip_memory"))) = 0; void bar attribute ((section (".sdram"))) (void) foo++;.section on_chip_memory.section.on_chip_memory GNU 4 36 Altera Corporation Nios II 2004 12

HAL.rwdata.rwdata HAL EPCS RAM HAL.text Nios II IDE Altera Flash Programmer _start EPCS.text HAL _reset _reset _start RAM HAL.rwdata.rodata alt_main() alt_load() Altera Corporation 4 37 2004 12 Nios II

HAL HAL HAL HAL Nios II HAL Nios II HAL HAL HAL <Nios II >/components HAL <Nios II >/components/altera_hal/hal/inc/sys #include <Nios II >/components/altera_hal/hal/inc/ DMA #include sys/alt_dma/h system.h HAL Nios II IDE Newlib ANSI C <Nios II >/bin HAL Nios II IDE Nios II IDE HAL 4 38 Altera Corporation Nios II 2004 12