Error while trying to use flashlib.

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
Matt
Active Member
Posts: 50
Joined: Sat Feb 13, 2010 12:04 pm

Error while trying to use flashlib.

Post by Matt »

I am trying to integrate the flashlib library and I am following the example given but I am getting an error in my c file.

Code: Select all

#include <stdio.h>
#include <stdlib.h>
#include <flashlib.h>

extern fl_PortHolderStruct spiPorts;


int xFlashConnect()
{
	return fl_connect(&spiPorts);
}
gives the error
xmake all
Creating dependencies for xflash.c
Compiling xflash.c
Creating xtcp_demo.xe
.././src/Common/xflash.c: Error: Undefined reference to 'fl_connect'
Its something simple I am sure but I fail to see it right now.
As far as I knew adding the header for the flashlib should have taken care of it?

Thanks in advance


richard
Respected Member
Posts: 318
Joined: Tue Dec 15, 2009 12:46 am

Post by richard »

You need to link against the flash library, see

http://www.xmos.com/discuss/viewtopic.p ... ilit=flash
Matt
Active Member
Posts: 50
Joined: Sat Feb 13, 2010 12:04 pm

Post by Matt »

The project I am using is a make file project.
I added -libflash to the flags section of the makefile.
I am now getting the following error.
Creating xtcp_demo.xe
xmap: Error: Failed to find library "libibflash.a".

Here is the make file.
TARGET ?= XC-2
BASE_DIR = .

DEMO_SOURCE_DIRS = src src/Common src/FAT16 src/include src/SDbus

SOURCE_DIRS += $(DEMO_SOURCE_DIRS)

INCLUDE_DIRS += $(DEMO_SOURCE_DIRS)

XCC_FLAGS += -save-temps -g --show-report -libflash

USED_MODULES = module_xtcp.1v3 module_ethernet.1v3

include $(BASE_DIR)/../module_xmos_common.1v0/build/Makefile.common

all: $(BIN_DIR)/xtcp_demo.xe
@echo Build complete

clean: clean_common
Im thinking I need to include a reference to the directory for the lib files. I am not sure where it is getting the libibflash.a from???

any ideas.

Thanks in Advance

Matt
richard
Respected Member
Posts: 318
Joined: Tue Dec 15, 2009 12:46 am

Post by richard »

Sorry, I didn't check the post I linked to carefully enough :oops:. Use -lflash to link to the flash library, not -llibflash as it says there.
Matt
Active Member
Posts: 50
Joined: Sat Feb 13, 2010 12:04 pm

Post by Matt »

Almost have it but now I am getting the following error on compiling and can not find the reference in my project. Have you seen this before.
Constraint check for node 0, core 1:
Stack available: 000075c4, used: 00000f58 . OKAY
Threads available: 8, used: 3 . OKAY
Timers available: 10, used: 3 . OKAY
Chanends available: 32, used: 9 . OKAY
Constraints checks PASSED.
mcelf_n0c2_o_a04736: Error: Symbol __localPortInitializer22 is a duplicate clock declaration.
mcelf_n0c2_o_a04736: Error: previously declared as b_spi.
xmake: *** [bin/XC-2/xtcp_demo.xe] Error 1
I am trying to add it to the simple web server 1.3. perhaps there is a conflict but I can not find it.

Thank you for your help

Matt
Matt
Active Member
Posts: 50
Joined: Sat Feb 13, 2010 12:04 pm

Post by Matt »

Thanks to m_y here is the answer.

The duplicate definition is between libflash and mii which both want to use clock block 1.

Unfortunately the block isn't configurable in the flash library in 9.9.2 (it will be in the next release) but you can change which ones mii uses bu editing "main.xc" (look for XS1_CLKBLK_x near the top of the file).

Thanks again
Post Reply