embeded/FPGA - ALTERA2018. 1. 31. 19:27

32MB 짜리 SDRAM이 달려있는데

Nios II 여러개 생성할 때 분할해서 쓸 수 있을려나?


It is organized as 4M x 16 bits x 4 banks.

[링크 : ftp://ftp.altera.com/up/pub/Altera_Material/11.0/Tutorials/Verilog/DE0-Nano/Using_the_SDRAM.pdf]


on-chip memory로 부족한 메모리라 못했던걸, 이걸 이용하면 가능할거 같네?


메모리 관리문제로 hw mutex도 추가하라네?

[링크 : http://jjackson.eng.ua.edu/courses/ece680/lectures/Creating Multiprocessor Nios II Systems Tutorial.pdf]

'embeded > FPGA - ALTERA' 카테고리의 다른 글

xilinx easypath / Altera hardcopy  (0) 2018.02.02
Nios II Flash Programmer  (0) 2018.02.01
EPCS Controller 추가 및 jic 통합하기.. 실패중  (0) 2018.01.31
Nios II BSP 빌드관련  (0) 2018.01.31
SREC - SRECord  (0) 2018.01.30
Posted by 구차니
embeded/FPGA - ALTERA2018. 1. 31. 13:23

그래도 안되네 ㅠㅠ


설정 가능한 내용으로는 딱히 눈에 띄는건 없네


심심해서 SDRAM은 어떻게 추가하나했는데.. university program에 DE 보드 관련 SDRAM PLL은 존재하고

SDRAM은 별도로 추가를 해주어야 한다. (ISSI 칩 기본 프리셋 존재하지 않음)


이제 남은건.. sof 파일을 hex로 바꾸는건가...


sof를 시작주소 줄 수 있었군..

최소한 이렇게 하면, Nios II 자체는 구동하는걸로 보인다(LED 불 전부 꺼짐)

eclipse에서 테스트 해보니 장치 인식을 하는 것 봐서 정상적으로 Nios II는 들어간 듯


[링크 : https://www.alteraforum.com/forum/showthread.php?t=48733]


10. Click SOF Data, and select Add File, and select your .sof file

11. Click Add Hex data, select Relative addressing, and select your .hex file created above

12. Now push generate. You should verify that the generated .map file has Page_0 at a start address of 0x0, and the hex file at a start address 1 after the end address of Page_0

13. Now in the Quartus II Programmer, select Add File and select your .jic file. Check the Program box next to the .jic file, and push Start

[링크 : https://www.altera.com/support/support-resources/knowledge-base/solutions/rd10132010_126.html]


Creating the .jic file:


In Quartus, open the Convert "Programming File..." utility

Set the "Programming file type:" to "JTAG Indirect Configuration File (.jic)"

In "Input files to convert" select "Flash Loader", click "Add Device..." and choose your target FPGA device

If you are configuring the FPGA from the serial flash:

In "Input files to convert" select "SOF Data", click "Add File..." and select your FPGA .sof file

-With "SOF Data" selected, click "Properties", in the "SOF Data Properies dialogue box:

-Set "Address mode for selected pages to" to "Start"

Set "Start address (32-bit hexidecimal:) to 0x0.

In "Input files to convert" click "Add Hex Data", in the "Add Hex Data" dialogue box:

Set "Addressing mode" to "Absolute addressing"

Select your hex file using the "..." button next to the "Hex file" field

Click "OK"

Check "Create Memory Map File". This is useful for debugging.

Generate the .jic file and program it into the serial flash with the Quartus Programmer 

[링크 : http://www.alterawiki.com/wiki/Booting_Nios_from_Serial_Flash_with_the_new_Altera_Serial_Flash_Controller]


그나저나 빌드 메시지를 보니..

13:50:21 **** Build of configuration Nios II for project hello_world_0 ****

make mem_init_generate 

Info: Building ../hello_world_0_bsp/

C:/intelFPGA_lite/17.1/nios2eds/bin/gnu/H-x86_64-mingw32/bin/make --no-print-directory -C ../hello_world_0_bsp/

[BSP build complete]

Post-processing to create mem_init/hdl_sim/unsaved_epcs_flash_controller_0_boot_rom.hex...

elf2hex hello_world_0.elf 0x00011000 0x000117ff --width=32 --little-endian-mem --create-lanes=0 --no-zero-fill mem_init/hdl_sim/unsaved_epcs_flash_controller_0_boot_rom.hex

Post-processing to create mem_init/unsaved_onchip_memory2_0.hex...

elf2hex hello_world_0.elf 0x00008000 0x0000ffff --width=32 --little-endian-mem --create-lanes=0 mem_init/unsaved_onchip_memory2_0.hex

Post-processing to create mem_init/hdl_sim/unsaved_epcs_flash_controller_0_boot_rom.dat...

elf2dat --infile=hello_world_0.elf --outfile=mem_init/hdl_sim/unsaved_epcs_flash_controller_0_boot_rom.dat \

--base=0x00011000 --end=0x000117ff --width=32 \

--little-endian-mem --create-lanes=0 

Post-processing to create mem_init/hdl_sim/unsaved_onchip_memory2_0.dat...

elf2dat --infile=hello_world_0.elf --outfile=mem_init/hdl_sim/unsaved_onchip_memory2_0.dat \

--base=0x00008000 --end=0x0000ffff --width=32 \

--little-endian-mem --create-lanes=0 

Post-processing to create mem_init/hdl_sim/unsaved_epcs_flash_controller_0_boot_rom.sym...

nios2-elf-nm -n hello_world_0.elf > mem_init/hdl_sim/unsaved_epcs_flash_controller_0_boot_rom.sym

Post-processing to create mem_init/hdl_sim/unsaved_onchip_memory2_0.sym...

nios2-elf-nm -n hello_world_0.elf > mem_init/hdl_sim/unsaved_onchip_memory2_0.sym

Post-processing to create unsaved_epcs_flash_controller_0_boot_rom.flash...

elf2flash --input=hello_world_0.elf --outfile=unsaved_epcs_flash_controller_0_boot_rom.flash --sim_optimize=0 --little-endian-mem \

 --epcs 

Post-processing to create mem_init/meminit.spd...

Post-processing to create mem_init/meminit.qip...


13:50:26 Build Finished (took 4s.961ms) 



+

귀찮아서(!) 안하려고 했던 sof2flash를 꼭 거쳐야 하나보다.. 나처럼 EPCS에 구우려면..

3.3.1.3 EPCS Parameters

3.3.2 Programming Both Hardware and Software into an EPCS/EPCQ

Device

The --base parameter is not available for EPCS/EPCQ devices, because in EPCS/EPCQ devices, FPGA configuration data must start at address 0x0. However, if you are programming both an FPGA configuration and a Nios II software executable in the EPCS/EPCQ device, the --after parameter lets you position the software executable directly after the FPGA configuration data.

Convert the FPGA configuration file first using sof2flash. When converting the Nios II software executable, use the --after parameter, and specify the FPGA configuration S-record file. The S-record output for the software executable starts at the first address unused by the FPGA configuration. Refer to the second example under the “elf2flash Command-Line Examples” chapter.

Note: elf2flash does not insert the FPGA configuration into the output file. It simply leaves space, starting at offset 0x0, that is large enough for the configuration data.

Note: In Intel Quartus Prime software version 13.1 and onwards, the -epcs/--epcq option in sof2flash generates .flash file with a SOF header, which contains the SOF length.

This change is required for V-series devices and above for new SOF format, and to allow for future SOF format variations. The Nios II bootcopier loads the Nios II software executable from EPCS/EPCQ devices based on the SOF length. For more information about how to program EPCS/EPCQ devices, refer to the "KDB Solution rd11192013_118" webpage.

Related Links

• elf2flash Command-Line Examples on page 25

• KDB Solution rd11192013_118 

[링크 : https://www.altera.com/en_US/pdfs/literature/ug/ug_nios2_flash_programmer.pdf]



+

카페 자료 뒤지다 보니,

Eclipse에 Flash Programmer가 있대서 보니 오.. 이런게 있네..

그런데 프로젝트도 안 부르고 그냥 실했더니 먼가 에러뿜뿜


아무튼 이걸 이용하면 굳이 jic 안만들어도 EPCS controller가 있으면 EPCS에 쓸 수 있다고 한다. 

[링크 : https://www.altera.com/en_US/pdfs/literature/ug/ug_nios2_flash_programmer.pdf]

'embeded > FPGA - ALTERA' 카테고리의 다른 글

Nios II Flash Programmer  (0) 2018.02.01
de0-nano SDRAM with Nios II  (0) 2018.01.31
Nios II BSP 빌드관련  (0) 2018.01.31
SREC - SRECord  (0) 2018.01.30
altera Nios II, epcs controller  (0) 2018.01.29
Posted by 구차니
embeded/FPGA - ALTERA2018. 1. 31. 13:04

아무생각 없이(!) 전체 프로젝트를 Clean 했더니 아래와 같은 에러를 뱉어 주신다.

별거 없고 bsp 프로젝트 우클릭후 Nios II 에서 Generate BSP 해준다음

전체 프로젝트 빌드 하면된다.

13:01:21 **** Incremental Build of configuration Nios II for project hello_world_0_bsp ****

make all 

Makefile not up to date.

../../unsaved.sopcinfo has been modified since the BSP was generated.


Generate the BSP to update the Makefile, and then build again.


To generate from Eclipse:

 1. Right-click the BSP project.

 2. In the Nios II Menu, click Generate BSP.


To generate from the command line:

 nios2-bsp-generate-files --settings=<settings file> --bsp-dir=<target bsp files directory>


make: *** [public.mk] Error 1


13:01:22 Build Finished (took 946ms)


Run Configuration 에서

Download에 Start Processor와 Reset the selected target system을 해주면

다운로드 후 리셋을 걸고 시작하도록 하여 작동되는걸 바로 볼 수 있다

(먼가 이상하게 늦게 실행되는 느낌이 들어서 그거 없애는 용도)


이전글을 비교해보니.. 실수로 Start Processor의 체크를 꺼서 그런 듯

2018/01/27 - [embeded/FPGA] - Nios II 프로그램 빌드..


'embeded > FPGA - ALTERA' 카테고리의 다른 글

de0-nano SDRAM with Nios II  (0) 2018.01.31
EPCS Controller 추가 및 jic 통합하기.. 실패중  (0) 2018.01.31
SREC - SRECord  (0) 2018.01.30
altera Nios II, epcs controller  (0) 2018.01.29
Nios II / Nios II Classic 차이점  (0) 2018.01.29
Posted by 구차니
embeded/FPGA - ALTERA2018. 1. 30. 07:48

ALTERA에서 Nios II 용 바이너리를 변환하는 녀석으로

확장자가 flash가 튀어 나오는데, 내부 포맷은 SREC 라고 한다.

Motorola에서 개발했으니.. 원래는 PowerPC 계열에서 쓰던 걸려나?

아무튼 기본 포맷 유형은 intel HEX와 유사하다.


[링크 : https://en.wikipedia.org/wiki/SREC_(file_format)]


EPCS Controller-Based Boot Copier

EPCS controller-based boot copier supports EPCS memory only. Boot copier is stored in the ROM within

the EPCS flash controller. The boot copier is included during Qsys and Quartus Prime project compila‐

tion time.

The next stage boot image is located in the EPCS memory flash. The EPCS controller-based boot copier is

automatically appended into the SREC image (*.flash) file during the elf2flash utility execution in the

Nios II Flash Programming flow method.

[링크 : https://www.altera.com/en_US/pdfs/literature/ug/niosii_generic_booting_methods.pdf]

Posted by 구차니
embeded/FPGA - ALTERA2018. 1. 29. 20:47

생각을 해보니.. jic는 문제없이 만들어 진건데...

platform designer에서 EPCS Controller를 추가하지 않아서 작동하지 않는게 아닌가? 라는 생각이 든다.

다시 추가해서 시도해봐야겠다.


EPCS Controller-Based Boot Copier

EPCS controller-based boot copier supports EPCS memory only. Boot copier is stored in the ROM within

the EPCS flash controller. The boot copier is included during Qsys and Quartus Prime project compila‐

tion time.

The next stage boot image is located in the EPCS memory flash. The EPCS controller-based boot copier is

automatically appended into the SREC image (*.flash) file during the elf2flash utility execution in the

Nios II Flash Programming flow method. 


[링크 : https://www.altera.com/en_US/pdfs/literature/ug/niosii_generic_booting_methods.pdf]


My first Nios II 문서에 있는거랑 구성이 거의 비슷한데 EPCS와 SDRAM Controller가 추가되어 있다.

My application contains:


1. Clock Source

2. Nios II Processor

3. System ID

4. JTAG UART

5. EPCS Serial Flash Controller

6. PIO

7. SDRAM Controller

[링크 : https://alteraforum.com/forum/archive/index.php/t-49224.html]


음.. 리셋 벡터까지 EPCS Controller로 해주어야 하나?

Make sure the Nios II’s Reset Vector is pointing at EPCS/EPCQ Controller. 

[링크 : https://www.altera.com/support/support-resources/knowledge-base/solutions/rd11192013_118.html]

'embeded > FPGA - ALTERA' 카테고리의 다른 글

Nios II BSP 빌드관련  (0) 2018.01.31
SREC - SRECord  (0) 2018.01.30
Nios II / Nios II Classic 차이점  (0) 2018.01.29
elf2flash와 nios2-elf-objcopy 사용하기  (0) 2018.01.29
Nios II 이미지 합치기 (조사)  (0) 2018.01.27
Posted by 구차니
embeded/FPGA - ALTERA2018. 1. 29. 19:07

Nios II Classic에 구분되도록

Nios II Gen2라고 부르는 듯


아무튼.. Nios II Classic의 /e는 Nios II Gen2의 /e와 다른 물건이 되어버린듯 하다.

Nios II Gen2 Processor Feature Enhancements

The Nios II Gen2 processor family consists of /e and /f cores. It offers improvements over the Nios II Classic processor cores:

• Optional full 32-bit address space 

• Optional user-defined Peripheral address region for data cache bypass 

• Improved Qsys interface

The Nios II Gen2 /e core is completely backwards compatible with the Nios II Classic /s core. The Nios II Classic /s core has no direct equivalent in the Nios II Gen 2 family, however the Nios II Gen2 /f processor (as it has a more flexible configuration capability) can be configured to have the same feature set as the Nios II Classic /s core.


The Nios II Gen2 /f core offers the following feature enhancements over the Nios II Classic /f core: 

• Optional full ECC support, including data cache and TCMs (Tightly-coupled Memories) 

• Optional static branch prediction 

• Higher performance multiplier

• Improved and more deterministic divider 

• 64-bit multiply supported on all devices 

• Improved low-cost shifter implementation up to 4 bits/cycle 

• Instruction cache is now optional even when JTAG debug is present 

• New system interface for system trace 

[링크 : https://www.altera.com/en_US/pdfs/literature/an/an748.pdf]

'embeded > FPGA - ALTERA' 카테고리의 다른 글

SREC - SRECord  (0) 2018.01.30
altera Nios II, epcs controller  (0) 2018.01.29
elf2flash와 nios2-elf-objcopy 사용하기  (0) 2018.01.29
Nios II 이미지 합치기 (조사)  (0) 2018.01.27
Nios II 프로그램 빌드..  (0) 2018.01.27
Posted by 구차니
embeded/FPGA - ALTERA2018. 1. 29. 14:09

일단 필요로 하는 녀석은 아래 경로에 존재하는데

path가 설정안되어 있으면 에러가 날테니 적당히~ 사용

C:\intelFPGA_lite\17.1\nios2eds\bin

C:\intelFPGA_lite\17.1\nios2eds\bin\gnu\H-x86_64-mingw32\bin 


D:\>C:\intelFPGA_lite\17.1\nios2eds\bin\elf2flash.exe --input=hello_world_0.elf --output=swimage.flash --epcs

D:\>dir

2018-01-27  오후 01:19               946 hello_world.c

2018-01-27  오후 01:20           319,239 hello_world_0.elf

2018-01-27  오후 01:20            86,021 hello_world_0.map

2018-01-29  오후 01:53            11,824 swimage.flash


D:\>C:\intelFPGA_lite\17.1\nios2eds\bin\gnu\H-x86_64-mingw32\bin\nios2-elf-objcopy.exe -I srec -O ihex swimage.flash  swimage.hex

D:\>dir

2018-01-27  오후 01:19               946 hello_world.c

2018-01-27  오후 01:20           319,239 hello_world_0.elf

2018-01-27  오후 01:20            86,021 hello_world_0.map

2018-01-29  오후 01:53            11,824 swimage.flash

2018-01-29  오후 01:57            13,272 swimage.hex 


도대체 무슨 마법이냐.. 312KB 짜리가 12KB가 되다니.. -_-?

ELF에 이것저것 디버그 정보도 들어가서 커졌을수는 있지만 이해할수 없는 용량 감소네..

아무튼 위는 flash 파일 아래는 hex 파일 내용이다.

flash는 intel HEX 포맷이랑 비슷한거 같네.. 아무튼 덕분에(?) flash에서 hex로의 변환에서

용량 차이는 크게 나타나지 않는다.

S00600002D454C3B

S325000000007C0F00000000010074004000140840083A6800080000000000000000000000008C

S3250000002000000000000000007400C0061400E0DE74008006148CA4D67400800014498510B4

S325000000407400C000144DC5182603C010150000100401801036FDFF10C0251000C03310003B

:100000007C0F00000000010074004000140840084C

:100010003A68000800000000000000000000000036

:1000200000000000000000007400C0061400E0DEC4

:1000300074008006148CA4D67400800014498510C6


아무튼 변경후에는...  SOF 추가하고

HEX도 추가했는데 시작주소가 auto라니 찜찜(?) 해서


Properties 에서 시작주소를 0x0 으로 해주니 정상대로 나온다.


췟.. 플래시 로더 안 넣었다고 못 만드네 아무튼 넣고 만드니 8MB 자리 jic 통~


구워는봤는데 안되네..

귀찮아서.. (!) Nios II 이미지인 sof를 그냥 jic에 넣어서 그런가.. 똑같이 hex로 변환해서 넣어야 하나?


sof는 jic로 변환한 내용 처음에 0xff로 시작한다.

합친건데.. 이미지 순서가 아마 반대로 들어온 듯 하다..


프로그램이 앞에 들어가있고 그 이후에 sof 내용이 들어있다.

(쭈욱 내려보면 sof파일의 내용이 시작하는 부분이 보인다)



---

sof2flash --input=<hwimage>.sof --output=hwimage.flash --epcs --verbose

elf2flash --input=<elf file>.elf --output=swimage.flash --epcs --after=hwimage.flash --verbose


nios2-elf-objcopy -I srec -O ihex hwimage.flash  hwimage.hex

nios2-elf-objcopy -I srec -O ihex swimage.flash  swimage.hex 

[링크 : https://www.altera.com/support/support-resources/knowledge-base/solutions/rd12092009_471.html]

[링크 : https://www.altera.com/support/support-resources/knowledge-base/solutions/rd10132010_126.html]

'embeded > FPGA - ALTERA' 카테고리의 다른 글

altera Nios II, epcs controller  (0) 2018.01.29
Nios II / Nios II Classic 차이점  (0) 2018.01.29
Nios II 이미지 합치기 (조사)  (0) 2018.01.27
Nios II 프로그램 빌드..  (0) 2018.01.27
Nios II 명령어 관련 조사  (0) 2018.01.26
Posted by 구차니
embeded/FPGA - ALTERA2018. 1. 27. 22:36

elf로 뱉어 내는거 같은데

일단.. Add Hex 하면서 Relative로 0x00 이 기본인거 같긴한데

map 파일에서 Page_0의 시작 주소를 확인하라고 되어있네


The method used to create a .jic file with a Nios® II hardware and software image is as follows.

1. Create a flash file from a .sof file: sof2flash --input=<hwimage>.sof --output=hwimage.flash --epcs --verbose

2. Create a flash file from a ,elf file: elf2flash --input=<elf file>.elf --output=swimage.flash --epcs --after=hwimage.flash --verbose

3. Convert the .flash image into a.hex file: nios2-elf-objcopy --input-target srec --output-target ihex mysw.flash mysw.hex

4. In the Quartus® II software, open File > Convert Programming Files > Set the programming file as JTAG Indirect Configuration File (.jic).


6. Select the correct size EPCS device in the Configuration pull-down

7. Name your output .jic file

8. Click Flash Loader below, and select Add Device on the right hand side

9. Select your FPGA device from the list

10. Click SOF Data, and select Add File, and select your .sof file

11. Click Add Hex data, select Relative addressing, and select your .hex file created above

12. Now push generate. You should verify that the generated .map file has Page_0 at a start address of 0x0, and the hex file at a start address 1 after the end address of Page_0

13. Now in the Quartus II Programmer, select Add File and select your .jic file. Check the Program box next to the .jic file, and push Start 

[링크 : https://www.altera.com/support/support-resources/knowledge-base/solutions/rd10132010_126.html]


The method used to create a .jic file with a Nios® II hardware and software image is as follows.

1.      Create a flash file for the hardware and software image
sof2flash --input=<hwimage>.sof --output=hwimage.flash --epcs --verbose
elf2flash --input=<elf file>.elf --output=swimage.flash --epcs --after=hwimage.flash --verbose

Note: When creating the software flash image, there is no need to add a boot srec (this is located in the EPCS Controller), the --after option ensures the software image starts immediately after the hardware image.

2.      Convert the flash images into Hex files

nios2-elf-objcopy -I srec -O ihex hwimage.flash  hwimage.hex
nios2-elf-objcopy -I srec -O ihex swimage.flash  swimage.hex

3.      When creating your jic file using Quartus® II Convert Programming File tool, add the Flash Loader and both hex files with absolute addressing option selected.

Note: You do not need to add the .sof file to the jic image.  This is because you created a hardware hex image.  Using the hardware hex image ensures the software hex image is at the proper offset in the EPCS. 

[링크 : https://www.altera.com/support/support-resources/knowledge-base/solutions/rd12092009_471.html]


+

[링크 : https://www.altera.com/en_US/pdfs/literature/ug/ug_nios2_flash_programmer.pdf]

'embeded > FPGA - ALTERA' 카테고리의 다른 글

Nios II / Nios II Classic 차이점  (0) 2018.01.29
elf2flash와 nios2-elf-objcopy 사용하기  (0) 2018.01.29
Nios II 프로그램 빌드..  (0) 2018.01.27
Nios II 명령어 관련 조사  (0) 2018.01.26
nios2 /e /f 별 설정  (0) 2018.01.25
Posted by 구차니
embeded/FPGA - ALTERA2018. 1. 27. 12:48

먼가 반갑도고 징글징글 한 eclipse mars.2?

아무튼 얘가 Nios II 용 프로그램을 빌드해주실 분이다.


File - New - Nios II Application and BSP from Template를 하라고 하는데


sopcinfo 파일을 지정하라고 한다.


아놔.. 망할 공백 -_ㅠ 일단 다른데로 저장해서 진행 ㄱㄱ


일단 파일을 지정하고 나면 약간의 시간 후에 cpu 이름이 뜬다.


프로젝트 이름은 대충 일단 쳐넣어 보고


기본 소스는 있으니까(머 printf("Hello from Nios II!\n"); 뿐이지만)

Run 눌러서 빌드+실행!

실행시에는 Nios II Hardware로 하라고 하는데


안되잖아 -ㅁ-?

일단 원인 검색중..

nios2-elf-g++  -T'../hello_world_0_bsp//linker.x' -msys-crt0='../hello_world_0_bsp//obj/HAL/src/crt0.o' -msys-lib=hal_bsp -L../hello_world_0_bsp/   -Wl,-Map=hello_world_0.map   -O0 -g -Wall   -mno-hw-div -mno-hw-mul -mno-hw-mulx -mgpopt=global  -o hello_world_0.elf obj/default/hello_world.o -lm -msys-lib=m

c:/intelfpga_lite/17.1/nios2eds/bin/gnu/h-x86_64-mingw32/bin/../lib/gcc/nios2-elf/5.3.0/../../../../../H-x86_64-mingw32/nios2-elf/bin/ld.exe: address 0x18dc0 of hello_world_0.elf section `.bss' is not within region `onchip_memory2_0'

c:/intelfpga_lite/17.1/nios2eds/bin/gnu/h-x86_64-mingw32/bin/../lib/gcc/nios2-elf/5.3.0/../../../../../H-x86_64-mingw32/nios2-elf/bin/ld.exe: address 0x18dc0 of hello_world_0.elf section `.bss' is not within region `onchip_memory2_0'

collect2.exe: error: ld returned 1 exit status

make: *** [hello_world_0.elf] Error 1


메모리가 부족해요 부터 이상한 소리들이 많은데 결국 도움 받은 글은 이것 하나네

프로젝트 중 _bsp로 끝나는 것에서 우클릭 Proeprties


Nios II BSP Properties 에서, 조금 기다리면 비활성화 된 내용들이 풀리는데


Reduced device drivers는 필수는 아니고

Optimization level로 필수는 아니지만

Small C library 는 필수로 해주어야 한다고 한다.

[링크 : https://www.alteraforum.com/forum/showthread.php?t=52418]


일단 소스를 변경하고 했는데 PIO_0_BASE로 된건 조금 헤매게 되네..

system.h 에 PIO로 검색해서 나오는 건데, pdf 파일의 버전과 달라서 그런지 생성되는 명칭이 다르다.

/*

 * "Hello World" example.

 *

 * This example prints 'Hello from Nios II' to the STDOUT stream. It runs on

 * the Nios II 'standard', 'full_featured', 'fast', and 'low_cost' example

 * designs. It runs with or without the MicroC/OS-II RTOS and requires a STDOUT

 * device in your system's hardware.

 * The memory footprint of this hosted application is ~69 kbytes by default

 * using the standard reference design.

 *

 * For a reduced footprint version of this template, and an explanation of how

 * to reduce the memory footprint for a given application, see the

 * "small_hello_world" template.

 *

 */


#include <stdio.h>

#include "system.h"

#include "altera_avalon_pio_regs.h"


int main() {

printf("Hello from Nios II!\n");

int count = 0;

int delay;

while (1) {

IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, count & 0x01);

delay = 0;

while (delay < 1000000) {

delay++;

}

count++;

}

return 0;


Run Configurations 에

Nios II Hardware 에서 Target Connection 오른쪽에 Refresh Connections가 창이 작아서 안보였는데

아무튼 이걸 눌러줘야 프로세서가 뜨고 프로그램이 정상적으로 작동하게 된다.

망할 -_- 자동 탐지 되는줄 알았는데 ㅠㅠ


아무튼 먼가 열심히 빌드하고 먼가 열심히 올리더니


printf()로 출력한거 나오고 LED가 깜박깜박 한다.


이제 남은건.. 바이너리 통합하기?

'embeded > FPGA - ALTERA' 카테고리의 다른 글

elf2flash와 nios2-elf-objcopy 사용하기  (0) 2018.01.29
Nios II 이미지 합치기 (조사)  (0) 2018.01.27
Nios II 명령어 관련 조사  (0) 2018.01.26
nios2 /e /f 별 설정  (0) 2018.01.25
my first Nios II with DE0-nano  (0) 2018.01.25
Posted by 구차니
embeded/FPGA - ALTERA2018. 1. 26. 16:08

Nios II 코어 생성하다 보니 명령어별 cycle이 나와서 한번 어떤 명령어 인가 조사를 해보는데..

관건은.. 1 cycle이냐 2 cycle 이냐로 갈리는 Multiply Extended 명령어들!


일단 일반적인 곱셈은

MUL

Multiplies rA times rB and stores the 32 low-order bits of the product to rC. The result is the same whether the operands are treated as signed or unsigned integers.

Operation에 rC <- (rA x rB)31...0 인데.. 32비트 연산이라는 의미 같고


MULXSS

Treating rA and rB as signed integers, mulxss multiplies rA times rB, and stores the 32 high-order bits of the product to rC.

Operation 에서 rC <- ((singed)rA) x ((signed)rB))63..32

32비트를 초과하는 상위 비트에 대해서 계산을 한다는 건가?

아무튼 확장 곱셈 명령으로는 세가지가 있는데 로직을 얼마나 사용할 진 모르겠지만

Big integer 계산하는게 아니라면 2 cycle로 처리가 가능하니 굳이 안하는게 이득일 것으로 보인다.

mulxss multiply extended signed/signed

mulxsu multiply extended signed/unsigned

mulxuu multiply extended unsigned/unsigned 

[링크 : https://www.altera.com/en_US/pdfs/literature/hb/nios2/n2cpu_nii51017.pdf]



+

어라.. Nios II (Classic) Processor 를 선택하니 Nios II/s가 보이네?


'embeded > FPGA - ALTERA' 카테고리의 다른 글

Nios II 이미지 합치기 (조사)  (0) 2018.01.27
Nios II 프로그램 빌드..  (0) 2018.01.27
nios2 /e /f 별 설정  (0) 2018.01.25
my first Nios II with DE0-nano  (0) 2018.01.25
Quartus 2 Programmer Mode 조사  (0) 2018.01.23
Posted by 구차니