Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


Syntax error: Unterminated quoted string

I am trying to program a STM32L476 Nucleo 64 board with a simple GPIO application using AC6 IDE. THe project was generated by the STM32CubeMX Plugin.

I changed project properties to “External Build” as opposed to “Internal Build” and I got the following error in the Console Window for the build operation:

Building file: ../Src/main.c
Invoking: MCU GCC Compiler
%cd%
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Dweak=”attributeweak” -Dpacked=”attributepacked” -DUSE_HAL_DRIVER -DSTM32L476xx -I”C:/STM32 Nucleo Projects/Chimes1-ST-20161115/Inc” -I”C:/STM32 Nucleo Projects/Chimes1-ST-20161115/Drivers/STM32L4xx_HAL_Driver/Inc” -I”C:/STM32 Nucleo Projects/Chimes1-ST-20161115/Drivers/STM32L4xx_HAL_Driver/Inc/Legacy” -I”C:/STM32 Nucleo Projects/Chimes1-ST-20161115/Drivers/CMSIS/Device/ST/STM32L4xx/Include” -I”C:/STM32 Nucleo Projects/Chimes1-ST-20161115/Drivers/CMSIS/Include” -Os -g3 -Wall -fmessage-length=0 -ffunction-sections -c -fmessage-length=0 -MMD -MP -MF”Src/main.d” -MT”Src/main.o” -o “Src/main.o” “../Src/main.c”
Syntax error: Unterminated quoted string
make: *** Src/main.o Error 2

10:16:03 Build Finished (took 342ms)

This seems to say that main.o, the object code, had an unterminated quoted string. How does one fix that?

Dave

Hi Dave,
- Right-click on the project >> Properties >> C/C++ Build >> Settings >> Tools Settings tab >> MCU GCC Compiler >> Symbols
- Remove the “” from both symbols weak and packed :
weak=attribute__weak
packed=attributepacked__
Please, may you let me know why using Internal Build?

(Sorry for bold characters .. cannot get ride of it)


Dear Vetch,Thanks for your help!

I changed the settings to these values as you said. but no change in outcome.
weak=attribute__weak?
packed=attributepacked?

I only used Internal build out of desperation to try sometning. I guess from your statement that is incorrect. I will use External Build from now on. This error is generated with External Build.

So I am still getting this same error 2 consistantly:

11:21:58 **** Incremental Build of configuration Debug for project Test2_ST_20161120 ****
make all
Building file: ../Src/main.c
Invoking: MCU GCC Compiler
%cd%
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Dweak=”attributeweak” -Dpacked=”attributepacked” -DUSE_HAL_DRIVER -DSTM32L476xx -I”C:/STM32 Nucleo Projects/Test2_ST_20161120/Inc” -I”C:/STM32 Nucleo Projects/Test2_ST_20161120/Drivers/STM32L4xx_HAL_Driver/Inc” -I”C:/STM32 Nucleo Projects/Test2_ST_20161120/Drivers/STM32L4xx_HAL_Driver/Inc/Legacy” -I”C:/STM32 Nucleo Projects/Test2_ST_20161120/Drivers/CMSIS/Device/ST/STM32L4xx/Include” -I”C:/STM32 Nucleo Projects/Test2_ST_20161120/Drivers/CMSIS/Include” -Os -g3 -Wall -fmessage-length=0 -ffunction-sections -c -fmessage-length=0 -MMD -MP -MF”Src/main.d” -MT”Src/main.o” -o “Src/main.o” “../Src/main.c”
Syntax error: Unterminated quoted string
make: *** Src/main.o Error 2

11:21:58 Build Finished (took 371ms)

Note that even though I edited the weak and packed lines in the settings, they still show up in the console window with “”“.

Thanks,

Dave


Thats really strange. I copied the contents of the Console window with:

-mfpu=fpv4-sp-d16 -Dweak=”attributeweak” -Dpacked=”attributepacked

But when it posts it changes to:

-mfpu=fpv4-sp-d16 -Dweak=”attributeweak?” -Dpacked=”attributepacked?”


Why is that????

Dave


It did it again. I can’t copy the actual statement into the post without it changing!!!
France

Hi,

This is due to the fact that double parentheses are used to refer to pages on the web site, like it is explained in Wiki Syntax Help. Note that this link was typed as
 
((Wiki Syntax Help))

As a matter of fact, when a post includes code, or code-like sequences, it is better to use the CODE plugin, like this:
xxxxxxxxxx
 
{CODE()} C-like code block, with { ... } or ((...)) sequences{CODE}
This will greatly enhance the readability of your posts.

Note the parentheses in the opening CODE plugin invocations (where BTW you may add plugin-dependent parameters) which differentiates them from closing invocations.

Also, if you want to check how your post will appear on the site without effectively posting it, use the “Preview” button at the bottom of the page...

Bernard (Ac6)

Thanks Bernard, much appreciated!

Sorry, because of the reformating, my previous post was not clear at all.
Attached the snapshot for the week and packed symbols.

Thanks Vetch for the update. I made the change exactly as you show in the .png file. After Build, I still get Error 2 message, but it is now for unexpected “(“.

Is the Syntax error in the main.c file or the main.o file? I would guess the main.c file. I will try and find it. THe problem is that if there is a syntax error in main.c, it was caused by the Cube MX code generator. I did not add or change anything in the files generated by CubeMX.

Thanks again, I need all the help I can get! I have had successful embedded projects previously using TI uControllers. They seemed to be much more straightforward and easier to program than these ST devices.


13:07:24 **** Incremental Build of configuration Debug for project Test3_ST_20161120 ****
make all
Building file: ../Src/main.c
Invoking: MCU GCC Compiler
%cd%
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Dweak=attributeweak -Dpacked=attributepacked -DUSE_HAL_DRIVER -DSTM32L476xx -I”C:/STM32 Nucleo Projects/Test3_ST_20161120/Inc” -I”C:/STM32 Nucleo Projects/Test3_ST_20161120/Drivers/STM32L4xx_HAL_Driver/Inc” -I”C:/STM32 Nucleo Projects/Test3_ST_20161120/Drivers/STM32L4xx_HAL_Driver/Inc/Legacy” -I”C:/STM32 Nucleo Projects/Test3_ST_20161120/Drivers/CMSIS/Device/ST/STM32L4xx/Include” -I”C:/STM32 Nucleo Projects/Test3_ST_20161120/Drivers/CMSIS/Include” -Os -g3 -Wall -fmessage-length=0 -ffunction-sections -c -fmessage-length=0 -MMD -MP -MF”Src/main.d” -MT”Src/main.o” -o “Src/main.o” “../Src/main.c”
Syntax error: “(” unexpected
make: *** Src/main.o Error 2

13:07:25 Build Finished (took 653ms)

I checked all the *.c files for an extra “(” but could find none. Tried rebuilding again and just got the below again:

x
 
13:49:15 **** Build of configuration Debug for project Test3_ST_20161120 ****
make all 
Building file: ../Src/main.c
Invoking: MCU GCC Compiler
%cd%
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -D__weak=__attribute__((weak)) -D__packed=__attribute__((__packed__)) -DUSE_HAL_DRIVER -DSTM32L476xx -I"C:/STM32 Nucleo Projects/Test3_ST_20161120/Inc" -I"C:/STM32 Nucleo Projects/Test3_ST_20161120/Drivers/STM32L4xx_HAL_Driver/Inc" -I"C:/STM32 Nucleo Projects/Test3_ST_20161120/Drivers/STM32L4xx_HAL_Driver/Inc/Legacy" -I"C:/STM32 Nucleo Projects/Test3_ST_20161120/Drivers/CMSIS/Device/ST/STM32L4xx/Include" -I"C:/STM32 Nucleo Projects/Test3_ST_20161120/Drivers/CMSIS/Include"  -Os -g3 -Wall -fmessage-length=0 -ffunction-sections -c -fmessage-length=0 -MMD -MP -MF"Src/main.d" -MT"Src/main.o" -o "Src/main.o" "../Src/main.c"
Syntax error: "(" unexpected
make: *** [Src/main.o] Error 2
13:49:15 Build Finished (took 651ms)


(I used Bernards “Code” plugin to make the Console Window contents correct this time)

This is very frustrating. I feel that I am fighting a program bug that is caused by ST since I have not written any code into the project that was created by CubeMX!!!

France

Hi,

The syntax error here is neither in main.c or in main.o but in the command line itself; the problem is that parentheses are someway special when using the external builder. Can you try reverting to the Internal builder?

BTW I just hecked and, on Windows, I can build successfully with the project as generated by CubeMX (that is with quotes around the value of the packed symbol) both with the internal and external builder. Looking at your traces (and especially the %CD% thing) it seems you are running on Linux; could you confirm that?

In fact here we seem to fall into one difference between the internal builder and external builder on Linux:

  • The internal builder strips one level of quotes in arguments, wherever they are located
    • -Dfoobar=”FooBar” is seen as -Dfoobar=FooBar and expanded as FooBar (an identifier) by the C compiler
    • “-Dfoobar=FooBar” is (also) seen as -Dfoobar=FooBar and expanded the same
  • The external builder will strip one level of quotes, but only if they enclose the whole parameter:
    • -Dfoobar=”FooBar” is seen as -Dfoobar=”FooBar” and expanded as “FooBar” (a character string) by the C compiler
    • “-Dfoobar=FooBar” is seen as -Dfoobar=FooBar and expanded as FoBar (an identifier) by the C compiler


The problem is that, currently, it is not possible to generate the second form in a project; thus CubeMX will probably only work using the internal builder; I will look at the problem on Linux to confirm and look for a solution there.

Bernard (Ac6)

Bernard,
I am using Widows 7 Professional for this project. I now think my copy of STM32 is corrupted. I am going to uninstall and re-install it. When I look at the settings window under properties, it is all messed up.

Dave


Hi Dave, I understand your fustration.
I created many projects from CubeMX for the L476 Nucleo 64.
I didn’t faced this issue but I am trying to reproduce it.
Would it be possible for you to post the main.c?
I am using SW4STM32 version 1.11.0...May you check your version? You can update the SW4STM32 with :
Help menu >> Check for Updates

Vetch,

Here is the version number:

System Workbench for STM32 - C/C++ Embedded Development Tools for MCU

Version: 1.11.0.201610101240
Build id: @build@

I uninstalled Workbench and reinstalled it and it still has the same problems. I included the Properties>>C/C++ Build>>Settings window. Note that there is just a large empty rectangle in it. I don’t think that was like that when I started. Also note in this and the other .png that it says:

Orphaned configuration. No base extension cfg exists for fr.ac6.managedbuild.config.gnu.cross.exe.debug.405185049

That was not there before either. Is it me or just buggy software!

Just getting more frustrated.

Dave

I tried a different example, the DTA converter that uses DMA to generate a waveform. Now the problems with the GPIO example have gone away and the build runs with no errors! However, it still does not run. Attached is the error dialog box when a run is attempted.

I noticed that there is a debug Bug symbol on “STM32L476RG_NUCLEO.elf” in the project explorer window and then a tiny wrench in the icon next to “startup_stm32l476xx.s” What does that mean?

Could the Cube MX and associated file exaples be corrupted?

I will try re installing that next.

Dave

Another day, a new set of problems. I reloaded the en.stm32cubel4 zip file and extracted it to directory “C:/Cub”. I tried to build the example project “GPIO_IOToggle”. I got a whole bunch of Error 1, which looks like a result of not finding a needed file such as a header file. The attached png shows the console window result of the build.

Why am I having such errors for example projects that I have not modified at all!!! How can I write any code with confidence when the example projects don’t run!!!!

Still very frustrated,

Dave


Dear Dave,
You are using the latest version : it should be good.
I compiled and launched the debug successfully for the same project = DAC_SignalsGeneration for the STM32L476RG-Nucleo. Here is the way I used :
1 - Launch SW4STM32 and I select the workspace (inside the HAL) :
...\STM32Cube_FW_L4_V1.5.0\Projects\STM32L476RG-Nucleo\Examples\DAC\DAC_SignalsGen
eration\SW4STM32
2 - Right-click in the Project Explorer window >> Import >> General >> Existing Projects into Workspace >> Next >> Browse >> Select the project folder = STM32L476RG_NUCLEO >> Finish
3 - Right-click on the project >> Properties >> C/C++ General >> Indexer >> Enable project specific settings >> Remove the Index unused headers >> Apply >> OK
4 - Right-click on the project >> Properties >> C/C++ Build >> Settings >> Tool Settings tab >>MCU GCC Compiler >> Dialect >> ISO C99 >> Apply >> OK
5 - Right-click on the project >> Properties >> C/C++ Build >> Enable parallel build >> Apply >> OK
6 - Clean then Build
7 - Launch the Debug session as shown in the snapshot


 

Newest Forum Posts

  1. Монтаж камина с грилем в Москве - установка и барбекю by KpddomErorb, 2025-05-10 18:28
  2. SPI on Nucleo_STMH533RE by royjamil, 2025-05-04 20:13
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  9. Build a project in "release" mode by tang, 2025-02-20 10:36
  10. Build a project in "release" mode by info@creosrl.it, 2025-02-19 17:35

Last-Modified Blogs