doragasu 0 Posted November 12, 2012 Share Posted November 12, 2012 I have recently received my Stellaris Launchpad and I'm building a toolchain to code for it using GNU+Linux. So far I have the cross compiler+lm4tools+stellarisware running. I can build the stellaris examples and flash them without problems. As I want to do some signal processing with my board, I'd like to build the CMSIS library. At least the DSPLib part (I don't need the RTOS right now). The library zip file has some scripts to build it using Keil, but as I'm a GNU+Linux user, I can't run Keil IDE. Also unfortunately, I'm a total noob when talking about autotools, so... Has anyone been able to build this library using GCC? Does anyone have a Makefile to automate building it? Thanks in advance! skaidaif 1 Quote Link to post Share on other sites
bluehash 1,581 Posted November 12, 2012 Share Posted November 12, 2012 I have recently received my Stellaris Launchpad and I'm building a toolchain to code for it using GNU+Linux. So far I have the cross compiler+lm4tools+stellarisware running. I can build the stellaris examples and flash them without problems. As I want to do some signal processing with my board, I'd like to build the CMSIS library. At least the DSPLib part (I don't need the RTOS right now). The library zip file has some scripts to build it using Keil, but as I'm a GNU+Linux user, I can't run Keil IDE. Also unfortunately, I'm a total noob when talking about autotools, so... Has anyone been able to build this library using GCC? Does anyone have a Makefile to automate building it? Thanks in advance! You should be able to once you add the appropriate .c and .h includes into the stellaris makefile, unless you are tryiing to make a cmsis library. Quote Link to post Share on other sites
doragasu 0 Posted November 12, 2012 Author Share Posted November 12, 2012 I'd like to build it as a separate library. I can try building the Makefile, but I'm pretty busy right now, and I was asking just in case anyone has already done it and can save me some time. Quote Link to post Share on other sites
bluehash 1,581 Posted November 12, 2012 Share Posted November 12, 2012 This TI pdf tell you how to build one in CCS. Using the CMSIS DSP Library in CCS for Stellaris Quote Link to post Share on other sites
doragasu 0 Posted November 13, 2012 Author Share Posted November 13, 2012 Thanks again for help. I already knew that PDF, and had a look at it, but the procedure is full of TI compiler related stuff that I suspect is not necessary when building with GCC. Past weekend I tried compiling a single DSPLib file and it worked flawlessly. I suspect writing a dirty Makefile that does the work will not be very painful even for an autotools noob like me. I just need to get some spare time, sit down and write it ¬_¬ Quote Link to post Share on other sites
bluehash 1,581 Posted November 13, 2012 Share Posted November 13, 2012 Thanks again for help. I already knew that PDF, and had a look at it, but the procedure is full of TI compiler related stuff that I suspect is not necessary when building with GCC. Past weekend I tried compiling a single DSPLib file and it worked flawlessly. I suspect writing a dirty Makefile that does the work will not be very painful even for an autotools noob like me. I just need to get some spare time, sit down and write it ¬_¬ Its a learning experience. I'm sure you will learn alot doing it. Ask for help if you run into problems. Also, make sure you document your work here in a thread or you could also use the blog section in your account. Quote Link to post Share on other sites
doragasu 0 Posted November 13, 2012 Author Share Posted November 13, 2012 I had some time and started writing a test makefile, that builds all .c files inside a DSPLib subdirectory and creates a library with them: PART=LM4F120H5QR PREFIX=arm-none-eabi- CC=gcc AR=ar RM=rm TEST_PATH=DSP_Lib/Source/BasicMathFunctions/ CFLAGS = -mthumb \ -mcpu=cortex-m4 \ -mfpu=fpv4-sp-d16 \ -mfloat-abi=softfp \ -Os \ -ffunction-sections \ -fdata-sections \ -std=c99 \ -Wall \ -DPART_${PART} \ -DARM_MATH_CM4 \ -D__FPU_PRESENT \ -IInclude objects := $(patsubst $(TEST_PATH)%.c,obj/%.o,$(wildcard $(TEST_PATH)*.c)) testlib: test $(PREFIX)$(AR) rcs testlib.a $(objects) test: $(objects) obj/%.o: $(TEST_PATH)%.c $(PREFIX)$(CC) $(CFLAGS) -c $< -o $@ clean: @$(RM) -f $(objects) @$(RM) -f testlib.a It worked as expected. The build process throws a lot of warnings like this: Include/arm_math.h: In function 'arm_pid_q15': Include/arm_math.h:4828:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] But I suppose I can ignore them. When I get some more time, I'll try to add all the directories to the process and build the entire library. I hope it works bluehash 1 Quote Link to post Share on other sites
bluehash 1,581 Posted November 13, 2012 Share Posted November 13, 2012 Awesome! Thanks. Quote Link to post Share on other sites
doragasu 0 Posted November 17, 2012 Author Share Posted November 17, 2012 I have built two makefiles. The first is the top-level one, and the second must be copied in each dsplib subfolder. Both share another file with constants: Makefile.inc Top level Makefile Bottom level Makefile Calling "make dsplib" builds the library. But unfortunately I have not been able to build the examples against it. This is what happens when I try to build arm_class_marks_example_f32.c: $ arm-none-eabi-gcc -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -Os -ffunction-sections -fdata-sections -std=c99 -Wall -DPART_LM4F120H5QR -DARM_MATH_CM4 -D__FPU_PRESENT -I../../../Include -L../../../Lib -ldsplib_lm4f arm_class_marks_example_f32.c -o arm_class_marks_example_f32 In file included from arm_class_marks_example_f32.c:67:0: ../../../Include/arm_math.h: In function 'arm_pid_q15': ../../../Include/arm_math.h:4828:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] arm_class_marks_example_f32.c: At top level: arm_class_marks_example_f32.c:139:9: warning: return type of 'main' is not 'int' [-Wmain] /tmp/ccAAxx9S.o: In function `main': arm_class_marks_example_f32.c:(.text.startup.main+0x2e): undefined reference to `arm_mat_mult_f32' arm_class_marks_example_f32.c:(.text.startup.main+0x3a): undefined reference to `arm_max_f32' arm_class_marks_example_f32.c:(.text.startup.main+0x46): undefined reference to `arm_min_f32' arm_class_marks_example_f32.c:(.text.startup.main+0x50): undefined reference to `arm_mean_f32' arm_class_marks_example_f32.c:(.text.startup.main+0x5a): undefined reference to `arm_std_f32' arm_class_marks_example_f32.c:(.text.startup.main+0x64): undefined reference to `arm_var_f32' /home/jalon/sat/lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): In function `exit': /home/jalon/src/stellaris/summon-arm-toolchain/build/arm-none-eabi/newlib/libc/stdlib/../../../../../gcc-linaro-4.6-2011.10/newlib/libc/stdlib/exit.c:65: undefined reference to `_exit' collect2: ld returned 1 exit status I could understand the error about the linker not finding _exit symbol, but I can't really understand why the linker is not finding arm_* functions. I'm linking against the library, and if I browse the symbols inside the library using nm command, I can see the problematic functions. For example: $ arm-none-eabi-nm ../../../Lib/libdsplib_lm4f.a | grep arm_mat_mult_f32 arm_mat_mult_f32.o: 00000000 T arm_mat_mult_f32 What am I doing wrong??? Quote Link to post Share on other sites
doragasu 0 Posted November 17, 2012 Author Share Posted November 17, 2012 I got the first example to build. I have built the .o file separately and then linked it using ld. Also had to add "--gc-sections -Thello.ld" options. The first one to eliminate the errors about ld not being able to find symbols in dsplib, and the second one to fix a warning about _start symbol not being found. hello.ld is a linker file copied from stellarisware files. The resulting ld invocation: $ arm-none-eabi-ld --gc-sections -L ../../../Lib -ldsplib_lm4f -Thello.ld arm_class_marks_example_f32.o -o arm_class_marks_example_f32 Unfortunately these examples are made to be tested using a simulator or a debugger. I have yet to set up my debugger. Is there a tutorial anywhere? Quote Link to post Share on other sites
bluehash 1,581 Posted November 18, 2012 Share Posted November 18, 2012 ntfreak has openocd running with the Stellaris launchpad's ICDI: http://forum.stellarisiti.com/topic/309-icdi-support-in-openocd/#entry549 Quote Link to post Share on other sites
doragasu 0 Posted November 19, 2012 Author Share Posted November 19, 2012 New makefile for building cmsis examples. It uses startup code and linker script from scompo. Quote Link to post Share on other sites
Bingo600 0 Posted November 21, 2012 Share Posted November 21, 2012 @doragasu Arm is moving CMSIS from http://onarm.com to http://arm.com/cmsis , including the CMSIS forum to http://forums.arm.com/ There is a CMSIS v3.01 (CMSIS-SP-00300-r3p1-00rel0.zip) on arm.com. Ohh if anyone want to share their Stellarisware Makefiles (for arm-gcc) , that would be nice /Bingo bluehash 1 Quote Link to post Share on other sites
doragasu 0 Posted November 22, 2012 Author Share Posted November 22, 2012 Thanks for the info. You can already find my makefiles shared in this post. Using them I have successfully built CMSIS3.0 DSPLib. I have to test if it also works for 3.01 version. Yesterday I also started writing some tutorials for Stellaris Launchpad development under Linux. Eventually I'll write one about building CMSIS, so stay tuned! bluehash and xpg 2 Quote Link to post Share on other sites
doragasu 0 Posted November 28, 2012 Author Share Posted November 28, 2012 I have built the FIR filtering example, but there's a weird problem with it. When I call the arm_fir_init_f32 function, a hard fault exception (NVIC3) is raised. I have debugged the CMSIS function, and this exception is raised when it cals memset function. The parameters passed to memset function are OK. What can be causing this exception? I really have no clue Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.