4

I wrote a simple project in Vivado SDK in order to test my HW-platform developed in Vivado. My problem is that the SDK doesn't recognise the sin() function. I've included the "math.h" library without any error, the program recognise the library where the sin() function is included (I checked it by my own).

I obtain this error:

C:\PATH...\Debug/../src/helloworld.c: undefined reference to `sin' collect2.exe: error: ld returned 1 exit status

I've read the answer in here and it is too general so it was useless to solve my problem. It's clear there is a problem of library but it's not clear how to solve it specifically in Vivado SDK.

I'm working with: OS: Windows 7

Vivado: 2016.1

Vivado SDK: 2016.1

Any solution???

Community
  • 1
  • 1
Arturete
  • 133
  • 2
  • 12

1 Answers1

6

As it was explain here in the Xilinx forum, you can add in the Arm v7 gcc liker the “m” value.

In order to set correctly this value navigate from the toolbox in Project -> Properties -> C/C++ Build -> Settings -> Arm v7 gcc linker -> Libraries -> Libraries(-l) -> Add… and here you can add the value “m”. This is valid for all the mathematical function that you want to use in your project.

enter image description here

You should see something like this in the end.

Leos313
  • 5,152
  • 6
  • 40
  • 69
  • 1
    It should work for some earlier versions as well. And for Vivado 2016.2 – Leos313 Jul 11 '16 at 13:53
  • 1
    Many thanks. That was exactly what I was looking for. – Arturete Jul 11 '16 at 14:21
  • I feel like I'm missing something. My project doesn't include the "arm v7 gcc linker" settings, just the compiler: [Screenshot](https://i.stack.imgur.com/XCKWQ.png). Is this possibly because I'm using the WebPACK license or do I need to add something else? – Charles Clayton Feb 18 '17 at 20:18
  • It seems you are not in the same window. – Leos313 Feb 18 '17 at 20:32
  • I am getting error "math function 'pow' is not supported for synthesis" while using pow function in my C code in HLS 2015.2. Can anybody help me to solve the error? I tried the same [trick](https://www.xilinx.com/support/answers/52971.html) but it is not working. Thank you. – Deepak Ingole Apr 06 '17 at 12:47