2013-11-25 06:21 PM
Hi guys,
I'm try to include a set of ASM functions in a project. I have to build this project with arm-none-eabi on a STM32F4-Discovery. My question is how modify the makefile to include the correct building process?
I tryed to add SRCS += filename.s line but it does not liketo the compiler
that reply: No rule to generate object ''path/filename.s''. needed for ''main.elf''. Stop.It's sound strange because in the make file there is yet a .s ''startup_stm32f4xx.s'' that seems included with the synthax above.
I attach it for your considerations.
Regards #stm32f4-discovery #assembly-language #know-your-tools #makefile2013-11-26 01:55 AM
What is the actual name, ''filename.s'' or ''path/filename.s''
Make sure the name specified in Makefile is exactly the same as the file you try to compile.2013-11-26 02:15 AM
Pay attention to new file location. Try to put this file in same location as other .s files & use same syntax.
-Mayla-To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2013-11-26 07:09 AM
2013-11-26 07:40 AM
Your OBJS definition creates a .o dependency list from the .c files it sees in the list using a substitution, it does not address .s or .S files. You will likely need to have a couple of lists and combine them.
I've done some GNU/MAKE stuff here using a template that I found that worked well for mehttps://drive.google.com/file/d/0B7OY5pub_GfIcU1XTDFDRlptZDg/edit?usp=sharing
Makefiles are complex, people have written whole books on using Make, suggest you review documentation, and search web for examples that suit your needs.2013-11-26 07:44 AM
Ok file paths match ! and the build process was gone... with errors #%$! I'm more confused now.
make[1]: uscita dalla directory ''/home/woozie/Scrivania/stm32f4-CBSSL/lib''
arm-none-eabi-gcc -g -O2 -Wall -Tstm32_flash.ld -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -Iinc -Ilib -Ilib/inc -Ilib/inc/core -Ilib/inc/peripherals -Ilib/inc/private -Ilib/inc/cbssl src/main.c src/system_stm32f4xx.c lib/ssl_CPURegTest.s lib/startup_stm32f4xx.s -o main.elf -Llib -lstm32f4
/home/woozie/development/toolchains/arm-205-23-arm-none-eabi-i686-pc-linux-gnu/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb2/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text+0x12): undefined reference to `_sbrk'
/home/woozie/development/toolchains/arm-205-23-arm-none-eabi-i686-pc-linux-gnu/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb2/libc.a(lib_a-writer.o): In function `_write_r':
writer.c:(.text+0x16): undefined reference to `_write'
/home/woozie/development/toolchains/arm-205-23-arm-none-eabi-i686-pc-linux-gnu/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb2/libc.a(lib_a-closer.o): In function `_close_r':
closer.c:(.text+0x12): undefined reference to `_close'
/home/woozie/development/toolchains/arm-205-23-arm-none-eabi-i686-pc-linux-gnu/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb2/libc.a(lib_a-fstatr.o): In function `_fstat_r':
fstatr.c:(.text+0x14): undefined reference to `_fstat'
/home/woozie/development/toolchains/arm-205-23-arm-none-eabi-i686-pc-linux-gnu/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb2/libc.a(lib_a-isattyr.o): In function `_isatty_r':
isattyr.c:(.text+0x12): undefined reference to `_isatty'
/home/woozie/development/toolchains/arm-205-23-arm-none-eabi-i686-pc-linux-gnu/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb2/libc.a(lib_a-lseekr.o): In function `_lseek_r':
lseekr.c:(.text+0x16): undefined reference to `_lseek'
/home/woozie/development/toolchains/arm-205-23-arm-none-eabi-i686-pc-linux-gnu/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb2/libc.a(lib_a-readr.o): In function `_read_r':
readr.c:(.text+0x16): undefined reference to `_read'
collect2: error: ld returned 1 exit status
make: *** [main.elf] Errore 1
________________
Attachments : stm32f4-CBSSL.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzzA&d=%2Fa%2F0X0000000bRk%2FOp6dQSXmLaStHLo6PL4myNq1LpFU7bxUZ.tIggYzxwM&asPdf=false
2013-11-26 07:45 AM
2013-11-26 07:56 AM
Ok file paths match ! and the build process was gone... with errors #%$! I'm more confused now.
Are you using STDIO printf/putchar or malloc/free type functions? NEWLIB? You seem to be missing code to implement SYSCALLS on your platform.[DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Discovery/FAT-FS%20%2B%20CoIDE&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F¤tviews=37]https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2FSTM32Discovery%2FFAT-FS%20%2B%20CoIDE&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F¤tviews=372013-11-26 09:52 AM
Great Clive1,
I tryed on the fly your suggest (stdio lib was included) and ...yes I built it!... Tonight I check the code for ensure that all work properly. Thanks again, Regards2013-11-27 06:39 PM
Another thing,
I'm assuming that the asm function is located on .s file, that the functions put return values in r0 & r1 (UAL rules) and that this functions are called by the main.c file. The problem is that when I try to execute this:
.section .text.Default_CPUTest_Handler,''ax''
.weak Default_CPUTest_Handler
.type Default_CPUTest_Handler, %function
Default_CPUTest_Handler:
CPU_RegisterTest:
mov pc,lr
push {lr}
mov r0, CPU_REGISTER_TEST_PASS
push {r0}
pop {r0}
pop {pc}
.end CPU_RegisterTest
.size Default_CPUTest_Handler, .-Default_CPUTest_Handler
called by:
1.
int testRes=CPU_RegisterTest();
in the main.c, trying to change r0 TestPassCondition from FAIL to PASS (from 0 to 1), the result is the same testRes ever maintains the 0 value.
Anyone can explain how to return from ASM func correctly?
thanks
Regards