「MAX 10 NEEK」へソフトコアCPUを組み込む(ソースコード)(2/3 ページ)

» 2016年09月09日 10時00分 公開
[PR/MONOist]
PR

List 2

  1. List 2:
  2. /*
  3. * "Hello World" example.
  4. *
  5. * This example prints 'Hello from Nios II' to the STDOUT stream. It runs on
  6. * the Nios II 'standard', 'full_featured', 'fast', and 'low_cost' example
  7. * designs. It runs with or without the MicroC/OS-II RTOS and requires a STDOUT
  8. * device in your system's hardware.
  9. * The memory footprint of this hosted application is ~69 kbytes by default
  10. * using the standard reference design.
  11. *
  12. * For a reduced footprint version of this template, and an explanation of how
  13. * to reduce the memory footprint for a given application, see the
  14. * "small_hello_world" template.
  15. *
  16. */
  17. #include <stdio.h>
  18. #include "system.h"
  19. #include "altera_avalon_pio_regs.h"
  20. int main()
  21. {
  22. printf("Hello from Nios II!\n");
  23. unsigned long cnt = 0;
  24. long delay;
  25. while(1)
  26. {
  27. IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, cnt&0x01);
  28. for(delay = 0; delay < 1000000; delay++);
  29. cnt++;
  30. }
  31. return 0;
  32. }
  33. endmodule
List2

提供:日本アルテラ株式会社
アイティメディア営業企画/制作:MONOist 編集部/掲載内容有効期限:2016年10月10日

Copyright © ITmedia, Inc. All Rights Reserved.