Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

How to write(or read) soft IP registers with ARM DS-5?

I have started working on Cyclone V SoC development board. Using golden reference design and bare-metal program, I have succeeded to print 'Hello' in ARM DS-5. Now I want to modify the same hello.c code so that I can write into a PIO register, which is there in the QSYS design.

For Nios processor, that would be easier as I just had to use, for example, IOWR(pio_base,offset,1). How can I do the same for ARM processor? Is there any function, like IOWR, for it? (Tired of searching about it on net)

In DS-5 debugger window, it shows avalon registers and their address. So, I can have the address of PIO but I can't figure out how can I access the PIO or for that matter any register of any peripheral IP.

(I am working on Windows OS)

26 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    These "path not found" lines present in console for each source file ?

    Good, if no C/C++ warnings, these lines probably from unecessary system variable: need save in Windows console all variables to file ("set > vars.txt") and find there strings as "\usr\include\w32api", think which soft adds these variable, and delete it if possible.

    I found 2 good GCC keys from a thousands:

    "-E" set compiler mode for preprocess only and output all merged ".c" + "#include" to one .o;

    "-H" output to console all# include files with its path for each .c.

    These options very usable for debug differences on work/nonwork SoC EDS on various PCs with identical paths of installation.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I search in the vars.txt, and cannot fine strings like "\usr\include\w32api" or anyother "path not found" lines.

    And not each source file has these warnings. the "hello world" project does not have.

    And I find if the source file has USER CONFIG environment variable,thses warnings occur will appear.

    Could you please explain in detail how to add these 2 GCC key in the project?since I am a green hand and I can not understand what you mean to do.

    thanks!
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Need be to open Makefile for edit and search first word "CFLAGS" with definition.

    In these line add "-E", "-H" and any more.

    ...Entire of PC files may search for "\usr\include\w32api" -- may be through a week any result found! :)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I add "-E" "-H" in the ”CFLAGS“,and when I build the project,error comes out.

    and I only add "-H",error not come out.

    THE console message is in the console.txt.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    linjionghui, you are programmer or student ? Except "Altera Pupil". Need be > independence in thinks !

    Console in both cases is different only at bottom: with using "-E" in .o-files not writed compiled object code (compile stage is omitted), and only expanded source with all# includes -- view these files!

    Then linker abuses, its unimportant.

    These .o-files after -E need be compared with analogous after preprocessing with compiler errors if appears in bad installation of SoC EDS, suddently there is bad# include paths or not same .h-files.

    Upper .h-output show used .h-folders and also may be saved and compared with "bad" installation output for analysis.

    P.S. Very strang: I view attachment 2 times, and see "console.txt (29.9 KB, 0 views)".