Makefile error: hwlib.h no such file or directory

Hi all,
I am getting this error in my make file

Here is my make file:
#
TARGET = FPGAHPS

#
CROSS_COMPILE = arm-linux-gnueabihf-
ALT_DEVICE_FAMILY ?= soc_cv_av 
CFLAGS = -static -g -Wall  -I${SOCEDS_DEST_ROOT}/ip/altera/hps/altera_hps/hwlib/include-D$(ALT_DEVICE_FAMILY)
LDFLAGS =  -g -Wall  
CC = $(CROSS_COMPILE)gcc
ARCH= arm


build: $(TARGET)
$(TARGET): main.o 
	$(CC) $(LDFLAGS)   $^ -o $@  
%.o : %.c
	$(CC) $(CFLAGS) -c $< -o $@

.PHONY: clean
clean:
	rm -f $(TARGET) *.a *.o *~ 

I have already included path to my windows environment variable. I have also attached my C file. Any help please? Here is my main.c code
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include “hwlib.h”
#include “socal/socal.h”
#include “socal/hps.h”
#include “socal/alt_gpio.h”
#include “hps_0.h”

#define REG_BASE 0xFF200000
#define REG_SPAN 0x00200000

void* virtual_base;
void* led_addr;
void* sw_addr;
int fd;
int switches;
int main (){
fd=open("/dev/mem",(O_RDWR|O_SYNC));
virtual_base=mmap(NULL,REG_SPAN,(PROT_READ|PROT_WRITE),MAP_SHARED,fd,REG_BASE);
sw_addr=virtual_base+SW_BASE;
led_addr=virtual_base+LED_BASE;
while(1){
switches=*(uint32_t *)sw_addr;
*(uint32_t *)led_addr=switches;
usleep(1000000);
printf("%u\n",switches);
}
return 0;
}

You are missing a space here. It should be (space inserted between include & -D):
CFLAGS = -static -g -Wall -I${SOCEDS_DEST_ROOT}/ip/altera/hps/altera_hps/hwlib/include -D$(ALT_DEVICE_FAMILY)

1 Like

hi,
thanks a lot. that worked . THank you so much again.

Hi! i have a similar issue about include problem

I’m starting now with DS-5 over cyclone5 soc, I’m want develop an application running under Linux Angstrom (it is ok, already running on my Cy5 card)

This code example includes some Hw libs and some linux related libs (as mman, fnctl.h) that contains references to interface virtual memory to hw memory one.

How I must set my DS-5 to find the right mman and fcntl libs? I understand that they should are the same related to my Linux running distro in the target…right?

In the distro folder there are a lof of them!!!

For socal and hw related, they are referred to my Hw project , ok, and I can copy under my sw project folder and include them directly…

but for mman and fnctl I have this doubt…

Have you a tip??

Thansk!!!

Hi,
I shall recommend to write complete path to a file into your .c code. Just simply write down complete path to the required file into your .c file.

Thanls. Muhammad.
I wish to have my projects managed better as possible, with clear include strategy… for this I asked …
Now I set my environment adding to PATH my angstrom path directory in which I keep my mman.h and it seems go ok!
I hope that is the correct way…

@filippo.tigli
Nice to hear that. Just wanted to ask about how did you add path directory. Can you please tell me a little bit of procedure because I am using windows 10. I also added my path to mmah.h in to the environment but still it was causing problems.

Hello! No problem… but I set path enviroment variable in DS-5 directly, not in Windows

If you go on to Project/Settings/C/C++ Builders/Environment, on the PATH rows you can ADD your desidered path for C-linux libraries…
I put my linaro path toolchain, used to create sd card and it runs.
Now my mman.h and fcntl.h allows my software to read/write LW AXI BUS from nios to hps and vice-versa, running a C application under Linux!

1 Like