Forum Discussion

garry's avatar
garry
Icon for New Contributor rankNew Contributor
6 years ago

ver171を使用しています。 標準関数の質問です。 # niosii_gen2(/e) +ram(64k) + led(pio) の構成。 # /mnt/host の機能を有効。 nios2_gen2 でfopenは使用できますか? 現在、Buildエラーが発生しています。 fopenが使用できる場合、どこから確認すればよいでしょうか? # なお、LEDは、デバッグ目的で点灯させます。 よろしくお願いします。

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include "system.h"

#include "io.h"

int main(void){

FILE *fp;

fp = fopen ("/mnt/host/test.txt", "r");

IOWR(LED_BASE,0,1); // LED

if (fp == NULL){

__asm("NOP"); // for break point

IOWR(LED_BASE,0,2); // LED

}

fclose(fp);

IOWR(LED_BASE,0,3); // LED

while(1){

__asm("NOP"); // trap

IOWR(LED_BASE,0,4); // LED

}

return 0;

}

3 Replies

  • garry's avatar
    garry
    Icon for New Contributor rankNew Contributor

    設定ミスでした。

    bsp-editorの"enable_small_c_library"​にチェックを入れていました。

    無事にBuildできたので、​本件closeとさせてください。

    お騒がせしました。

  • FawazJ_Altera's avatar
    FawazJ_Altera
    Icon for Frequent Contributor rankFrequent Contributor

    Hello,

    This is due to small memory size in Qsys. If you increase the size, you will be able to build. this option "enable_small_c_library" is used to optimize the BSP size in case of low memory space available.