build does not always search all the include paths

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

build does not always search all the include paths

686 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mspahr on Thu Aug 29 18:12:34 MST 2013
I am using LPCXpresso V5.2.6
The project is from LPWare/LPC11xx/Downloads/Software/Sample code bundle for LPC1xx peripherals using NXP LPCXpresso.
Project USB ROM MSC

Include paths (-I)
"${workspace_loc:/LPC11Uxx_Driver_Lib}"
"${workspace_loc:/CMSISv2p00_LPC11Uxx/inc}"
"${workspace_loc:/USB_ROM_MSC/inc}"
"${workspace_loc:/LPC11Uxx_Driver_Lib/inc}"


Sometimes the comiler call uses all of the paths.
Sometimes the compiler only tries the path in the 2nd line of the include list first.
If that fails it may try all the paths.
But it doesn't always retry with all of the paths.
It may go ahead and link using an old object file.
Is there a way to force build to use all of the include paths?
Two examples follow:
in both cases the file is in USB_ROM_MSC/inc

15:24:44 **** Incremental Build of configuration Release for project USB_ROM_MSC ****
make all
Building file: ../src/DiskImg.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DNDEBUG -D__CODE_RED -D__USE_CMSIS=CMSISv2p00_LPC11Uxx -I"C:\Documents and Settings\Mike\My Documents\Projects\Ghost\Copy of Test4\CMSISv2p00_LPC11Uxx\inc" -Os -g -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0 -mthumb -MMD -MP -MF"src/DiskImg.d" -MT"src/DiskImg.d" -o "src/DiskImg.o" "../src/DiskImg.c"
../src/DiskImg.c:1:26: fatal error: app_usbd_cfg.h: No such file or directory
compilation terminated.
make: *** [src/DiskImg.o] Error 1

15:24:46 Build Finished (took 2s.266ms)


15:24:47 **** Incremental Build of configuration Debug for project LPC11Uxx_Driver_Lib ****
make all
make: Nothing to be done for `all'.

15:24:47 Build Finished (took 438ms)

15:24:48 **** Incremental Build of configuration Debug for project CMSISv2p00_LPC11Uxx ****
make all
make: Nothing to be done for `all'.

15:24:48 Build Finished (took 531ms)

15:24:49 **** Incremental Build of configuration Debug for project USB_ROM_MSC ****
make all
Building file: ../src/DiskImg.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_CMSIS=CMSISv2p00_LPC11Uxx -I"C:\Documents and Settings\Mike\My Documents\Projects\Ghost\Copy of Test4\LPC11Uxx_Driver_Lib" -I"C:\Documents and Settings\Mike\My Documents\Projects\Ghost\Copy of Test4\CMSISv2p00_LPC11Uxx\inc" -I"C:\Documents and Settings\Mike\My Documents\Projects\Ghost\Copy of Test4\USB_ROM_MSC\inc" -I"C:\Documents and Settings\Mike\My Documents\Projects\Ghost\Copy of Test4\LPC11Uxx_Driver_Lib\inc" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0 -mthumb -MMD -MP -MF"src/DiskImg.d" -MT"src/DiskImg.d" -o "src/DiskImg.o" "../src/DiskImg.c"
Finished building: ../src/DiskImg.c

I have added I2C to the project and get the same problem in I2C.c not finding the paths.



15:10:33 **** Incremental Build of configuration Release for project USB_ROM_MSC ****
make all
Building file: ../src/i2c.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DNDEBUG -D__CODE_RED -D__USE_CMSIS=CMSISv2p00_LPC11Uxx -I"C:\Documents and Settings\Mike\My Documents\Projects\Ghost\Test4\CMSISv2p00_LPC11Uxx\inc" -Os -g -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0 -mthumb -MMD -MP -MF"src/i2c.d" -MT"src/i2c.d" -o "src/i2c.o" "../src/i2c.c"
../src/i2c.c:31:18: fatal error: type.h: No such file or directory
compilation terminated.
make: *** [src/i2c.o] Error 1

15:10:35 Build Finished (took 1s.516ms)

15:10:35 **** Incremental Build of configuration Debug for project USB_ROM_MSC ****
make all
Building file: ../src/i2c.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_CMSIS=CMSISv2p00_LPC11Uxx -I"C:\Documents and Settings\Mike\My Documents\Projects\Ghost\Test4\LPC11Uxx_Driver_Lib" -I"C:\Documents and Settings\Mike\My Documents\Projects\Ghost\Test4\CMSISv2p00_LPC11Uxx\inc" -I"C:\Documents and Settings\Mike\My Documents\Projects\Ghost\Test4\USB_ROM_MSC\inc" -I"C:\Documents and Settings\Mike\My Documents\Projects\Ghost\Test4\LPC11Uxx_Driver_Lib\inc" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0 -mthumb -MMD -MP -MF"src/i2c.d" -MT"src/i2c.d" -o "src/i2c.o" "../src/i2c.c"
Finished building: ../src/i2c.c

Building target: USB_ROM_MSC.axf

0 Kudos
10 Replies

612 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mspahr on Thu Sep 12 15:05:23 MST 2013
This has resolved this issue.
I also had to add the driver_lib paths to the release linker settings.

Thanks all for the help.

Mike
0 Kudos

612 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Thu Sep 12 13:19:18 MST 2013
You need to make sure that the release build of the cmsis library has been built. Same for any othe libraries. This is all documented on the code red faqs
0 Kudos

612 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mspahr on Thu Sep 12 12:18:39 MST 2013
OK, that fixed the compile issue.
Now I am getting a linker error for the release but debug is OK.
I compared the linker settings between debug and release
Release was missing the driver_lib paths. I copied but changed the Driver_lib/Debug to driver_lib/Release under -L.
This didn't fix it.
Note that this is not the original project.  I have added to it.

Building target: USB_ROM_MSC.axf
Invoking: MCU Linker
arm-none-eabi-gcc -nostdlib -Xlinker -Map="USB_ROM_MSC.map" -Xlinker --gc-sections -mcpu=cortex-m0 -mthumb -T "USB_ROM_MSC_Release.ld" -o "USB_ROM_MSC.axf"  ./src/DiskImg.o ./src/adc.o ./src/cr_startup_lpc11u.o ./src/i2c.o ./src/lpc11uxx_usbd_msc_mem.o ./src/main.o ./src/mem_lpc11uxx_usbdesc.o ./src/sbl_iap.o ./src/systick.o   -lCMSISv2p00_LPC11Uxx
c:/pgms/nxp/lpcxpresso_5.2.6_2137/lpcxpresso/tools/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/bin/ld.exe: cannot find -lCMSISv2p00_LPC11Uxx
collect2: ld returned 1 exit status
make: *** [USB_ROM_MSC.axf] Error 1

11:43:40 Build Finished (took 29s.797ms)

11:43:41 **** Incremental Build of configuration Debug for project CMSISv2p00_LPC11Uxx ****
make all
make: Nothing to be done for `all'.

11:43:41 Build Finished (took 375ms)

11:43:42 **** Incremental Build of configuration Debug for project USB_ROM_MSC ****
make all
Building target: USB_ROM_MSC.axf
Invoking: MCU Linker
arm-none-eabi-gcc -nostdlib -L"C:\Documents and Settings\Mike\My Documents\Projects\Ghost\Test4\CMSISv2p00_LPC11Uxx\Debug" -L"C:\Documents and Settings\Mike\My Documents\Projects\Ghost\Test4\LPC11Uxx_Driver_Lib\Debug" -L"C:\Documents and Settings\Mike\My Documents\Projects\Ghost\Test4\LPC11Uxx_Driver_Lib" -Xlinker -Map="USB_ROM_MSC.map" -Xlinker --gc-sections -mcpu=cortex-m0 -mthumb -T "USB_ROM_MSC_Debug.ld" -o "USB_ROM_MSC.axf"  ./src/DiskImg.o ./src/adc.o ./src/cr_startup_lpc11u.o ./src/i2c.o ./src/lpc11uxx_usbd_msc_mem.o ./src/main.o ./src/mem_lpc11uxx_usbdesc.o ./src/sbl_iap.o ./src/systick.o   -lCMSISv2p00_LPC11Uxx -lLPC11Uxx_Driver_Lib
Finished building target: USB_ROM_MSC.axf

make --no-print-directory post-build
Performing post-build steps
arm-none-eabi-size "USB_ROM_MSC.axf"; # arm-none-eabi-objcopy -O binary "USB_ROM_MSC.axf" "USB_ROM_MSC.bin" ; checksum -p LPC11U37_401 -d "USB_ROM_MSC.bin";
   text   data    bss    dec    hexfilename
  11756    192   1156  13104   3330USB_ROM_MSC.axf


11:43:46 Build Finished (took 3s.937ms)

include settings for both debug and release
"${workspace_loc:/LPC11Uxx_Driver_Lib}"
"${workspace_loc:/CMSISv2p00_LPC11Uxx/inc}"
"${workspace_loc:/USB_ROM_MSC/inc}"
"${workspace_loc:/LPC11Uxx_Driver_Lib/inc}"
0 Kudos

612 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Sep 12 00:52:13 MST 2013
OK, I can see there is an error in this project for the Release build. To fix, you will need to open the project properties, go to the compiler includes page and copy/paste the includes from the Debug build into the Release build. I will try to get the projects fixed and uploaded.

0 Kudos

612 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mspahr on Wed Sep 11 16:53:47 MST 2013
Restore defaults for the file properties did not fix this problem.
I selected Restore defaults, apply, OK for each file with the problem.
Again this is a sample project from LPCWare. I would expect the setup to be correct.

The project is from LPWare/LPC11Uxx/Downloads/Software/Sample code bundle for LPC11Uxx peripherals using NXP LPCXpresso.
Project USB ROM MSC
0 Kudos

612 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Tue Sep 03 23:50:39 MST 2013
I think this FAQ will explain your problem:
http://support.code-red-tech.com/CodeRedWiki/PerFileProperties

Summary:
- you are using different build settings for DiskImg.c to all of the other files in your build. Read the FAQ for information on how to reset.
0 Kudos

612 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mspahr on Tue Sep 03 11:23:50 MST 2013
I have attached 2 global console image files with verbose selected.
One it failed on diskimg.c because it did not try the correct path.
It repeated the compile with all paths selected and it builds OK.

The other example fails to build diskimg.c and does not retry.

I found that if I edit diskimg.c each time,
the first time build tries to compile, it fails because of the wrong path.
It always compiles diskimg.c again with all of the paths selected and passes.

This seems to allways generate the correct results.
However it has added allot of confusion with seeing the errors in the console.

Again, this is the example as downloaded from the web.
0 Kudos

612 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Fri Aug 30 12:25:51 MST 2013
You may know that the paths are correct, but you haven't proved to me that the compiler knows. So please add the verbose option and build again.
0 Kudos

612 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mspahr on Fri Aug 30 11:23:06 MST 2013
I know the paths are good, I can open the files it is looking for.
I can right click on the include statement and open decleration.

I have started over with a new workspace closer to the root instead of my documents.
I have imported LPWare/LPC11xx/Downloads/Software/"Sample code bundle for LPC1xx peripherals using NXP LPCXpresso".
I built LPC11Uxx_Driver_Lib
I built USB_ROM_MSC
This is the virgin sample with no modifications.
I get the following error:

10:03:58 **** Incremental Build of configuration Release for project USB_ROM_MSC ****
make all
Building file: ../src/DiskImg.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DNDEBUG -D__CODE_RED -D__USE_CMSIS=CMSISv2p00_LPC11Uxx -I"C:\Users\Mike\Ghost\Ver1\CMSISv2p00_LPC11Uxx\inc" -Os -g -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0 -mthumb -MMD -MP -MF"src/DiskImg.d" -MT"src/DiskImg.d" -o "src/DiskImg.o" "../src/DiskImg.c"
../src/DiskImg.c:1:26: fatal error: app_usbd_cfg.h: No such file or directory
compilation terminated.
make: *** [src/DiskImg.o] Error 1

10:03:59 Build Finished (took 1s.375ms)

10:04:00 **** Build of configuration Debug for project USB_ROM_MSC ****
make all
Building file: ../src/DiskImg.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_CMSIS=CMSISv2p00_LPC11Uxx -I"C:\Users\Mike\Ghost\Ver1\LPC11Uxx_Driver_Lib" -I"C:\Users\Mike\Ghost\Ver1\CMSISv2p00_LPC11Uxx\inc" -I"C:\Users\Mike\Ghost\Ver1\USB_ROM_MSC\inc" -I"C:\Users\Mike\Ghost\Ver1\LPC11Uxx_Driver_Lib\inc" -O0 -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0 -mthumb -MMD -MP -MF"src/DiskImg.d" -MT"src/DiskImg.d" -o "src/DiskImg.o" "../src/DiskImg.c"
Finished building: ../src/DiskImg.c

Building file: ../src/cr_startup_lpc11u.c
Invoking: MCU C Compiler
arm-none-eabi-gcc -D__REDLIB__ -DDEBUG -D__CODE_RED -D__USE_CMSIS=CMSISv2p00_LPC11Uxx -I"C:\Users\Mike\Ghost\Ver1\LPC11Uxx_Driver_Lib" -I"C:\Users\Mike\Ghost\Ver1\CMSISv2p00_LPC11Uxx\inc" -I"C:\Users\Mike\Ghost\Ver1\USB_ROM_MSC\inc" -I"C:\Users\Mike\Ghost\Ver1\LPC11Uxx_Driver_Lib\inc" -Os -g3 -Wall -c -fmessage-length=0 -fno-builtin -ffunction-sections -fdata-sections -mcpu=cortex-m0 -mthumb -MMD -MP -MF"src/cr_startup_lpc11u.d" -MT"src/cr_startup_lpc11u.d" -o "src/cr_startup_lpc11u.o" "../src/cr_startup_lpc11u.c"
Finished building: ../src/cr_startup_lpc11u.c

DiskImg.c properties
Include paths (-I)
"${workspace_loc:/LPC11Uxx_Driver_Lib}"
"${workspace_loc:/CMSISv2p00_LPC11Uxx/inc}"
"${workspace_loc:/USB_ROM_MSC/inc}"
"${workspace_loc:/LPC11Uxx_Driver_Lib/inc}"

The first time it tries to compile DiskImg.c it only uses the include path
"${workspace_loc:/CMSISv2p00_LPC11Uxx/inc}"
The file that it needs is in
"${workspace_loc:/USB_ROM_MSC/inc}"
It retries using all of the paths and that works.
This is the sample project with no modifications.

If I repeat the build, it gets the same error on DiskImg.c but does not retry with the other paths.
It then links using the old object file.

I tried changing the order of the includes, both for the file and for the project, same error.
I have repeated the build several times. Sometimes it retries with all paths, sometimes it doesn't.

With the sample project, it only has trouble with DiskImg.c
It I modify main.c and build, it passes all of the include paths to compile main.c.

If I add another c file to the project, it has the same problem of searching the wrong directory
and may or may not retry with all of the paths.

By the way, I am using Microsoft XP
0 Kudos

612 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Fri Aug 30 00:00:35 MST 2013
Try adding --verbose to the "Other flags" settings in MCU C Compiler->Miscellaneous

This will cause the compiler to list all of the directories it is searching for your includes (and will tell you if a directory does not exist).
0 Kudos