Tag Archives: STM32

[Solved] stm32 Failed to Download: Error: Flash Download failed – “Cortex-M3”

Error:

Error:Flash Download failed – “Cortex-M3”

 

Solution:

1. The correct device is not selected

2. The boot file does not correspond to the memory size

In C/C++

Large capacity chip corresponds to STM32F10X_HD,USE_STDPERIPH_DRIVER

Medium capacity corresponds to STM32F10X_MD,USE_STDPERIPH_DRIVER

Small capacity corresponds to STM32F10X_LD,USE_STDPERIPH_DRIVER

After modifying the letters, it is also necessary to confirm that there is a startup file with corresponding capacity in the project CORE file

3. Another place to set memory

Flash Dowmload in Debug Settings

Add correct Flash capacity through ADD/Remove

[Solved] Error: L6218E: Undefined symbol vApplicationGetIdleTaskMemory (referred from tasks.o).

I am using F103ZET6 board, after successful porting

I got two errors in stm32f10x_it.c

void SVC_Handler(void)

void PendSV_Handler(void)

Occupancy problem of two functions

Then the following two problems appeared in the compilation:

..\OBJ\LED.axf: Error: L6218E: Undefined symbol vApplicationGetIdleTaskMemory (referred from tasks.o).

..\OBJ\LED.axf: Error: L6218E: Undefined symbol vApplicationGetTimerTaskMemory (referred from timers.o).

 

Including the header file and the path of the header file

That’s a program error

The method is simple:

In FreeRTOS

Cancel the static memory request of FreeRTOS

#define configSUPPORT_DYNAMIC_ALLOCATION        1                       //Support for dynamic memory requests
#define configSUPPORT_STATIC_ALLOCATION 1 //Support static memory requests
#define configTOTAL_HEAP_SIZE ((size_t)(20*1024)) //System all heap size

#define configSUPPORT_DYNAMIC_ALLOCATION        1                       //Support for dynamic memory requests
#define configSUPPORT_STATIC_ALLOCATION 1 //Support static memory requests
#define configTOTAL_HEAP_SIZE ((size_t)(20*1024)) //System all heap size

[Solved] MDK Compile Error: error:No section matches selector – no section to be FIRST/LAST

In the process of using MDK, the compilation found that the error: No section matches selector – no section to be FIRST/LAST is generated, which means that the system driver file, i.e. .s file, is missing from the project.

There are two cases of missing .s files.

1. The .s file has not been added. If the .s file is not added, the .s file can be added to CMSIS (normally, under normal circumstances, the .s file is directly available in MDK_ARM), and after it is added, the compilation is successful.

In the process of adding .s file: find the left column at the main function .c file, and click Add in the file where it is located (file type click .s file for easy finding) .s file.

2. No .s file is generated. This error usually occurs when using MDK for the first time, usually because the file where the mdk’s keil is located is not in the same folder as the project file created. Just move the created project file into the mdk file.

[Solved] STM32 Use DAP to Download Error: Error: Flash Download failed – “Cortex-M3“

When using the DAP of wildfire, there is a problem in the title, and there is no Autodetect option in Magic Wand/Debug/Reset.

The Enable option in the pack needs to be removed.

At this time, the Autodetect option appears. Select this option, and the title problem will not occur again.

How to Solve UW Microcontroller KEIL _WEAK Error

1. The list of problems when __WEAK is not recognized by Keil compilation is as follows.
A screenshot of the problem that sometimes occurs when __WEAK is not recognized when compiling with Keil is as follows.

The error message prompted is as follows:

..\..\..\..\mcu\common\interrupts_hc32l13x.c(72): error:  #77-D: this declaration has no storage class or type specifier
  __WEAK void Uart1_IRQHandler(void);
..\..\..\..\mcu\common\interrupts_hc32l13x.c(72): error:  #65: expected a ";"
  __WEAK void Uart1_IRQHandler(void);
..\..\..\..\mcu\common\interrupts_hc32l13x.c(73): error:  #77-D: this declaration has no storage class or type specifier
  __WEAK void LpUart0_IRQHandler(void);
..\..\..\..\mcu\common\interrupts_hc32l13x.c(73): error:  #65: expected a ";"
  __WEAK void LpUart0_IRQHandler(void);
..\..\..\..\mcu\common\interrupts_hc32l13x.c(74): error:  #77-D: this declaration has no storage class or type specifier
  __WEAK void LpUart1_IRQHandler(void);
..\..\..\..\mcu\common\interrupts_hc32l13x.c(74): error:  #65: expected a ";"
  __WEAK void LpUart1_IRQHandler(void);
..\..\..\..\mcu\common\interrupts_hc32l13x.c(75): error:  #77-D: this declaration has no storage class or type specifier
  __WEAK void Spi0_IRQHandler(void);
..\..\..\..\mcu\common\interrupts_hc32l13x.c(75): error:  #65: expected a ";"

Solution:
Because it needs to be defined as __weak in Keil to be recognized (non-capitalized _WEAK), add the following lines of definition to the header file base_types.h file, and compile it OK!

#if defined (__ICCARM__)
#define __WEAK            __WEAK __ATTRIBUTES
#elif defined (__CC_ARM)
#define __WEAK            __weak
#else
#error    "unsupported compiler!!"
#endif

2. Cause analysis

ARM series compilation tool chain: __CC_ARM__, __ICCARM__, __GNUC__, __TASKING__
In order to solve the problem reported above, __ICCARM__ and __CC_ARM are defined, and a description is made here.

__CC_ARM corresponds to the platform: ARM RealView.
RealView is a set of development tools including compilation, debugging and simulation, which should be used in combination with development environments such as uvision, eclipse or CodeWarrior to form an integrated development environment.

__ICCARM__ corresponds to the platform: IAR EWARM.
Embedded Workbench for ARM is an integrated development environment developed by IARSystems for ARM microprocessors (hereinafter referred to as IAR EWARM). Compared to other ARM development environments, IAR EWARM is easy to start, easy to use, and compact in code.

The corresponding platform of __GNUC__ is: GNU Compiler Collection:
GCC was originally intended to be a compiler written specifically for the GNU operating system, which is thoroughly free software.

[Solved] KEIL Compile Error: Error: L6220E: Load region LR_IROM1 size (65552 bytes) exceeds limit (65536 bytes)……

Problem Description:

Stm32f103cbt6 keil compilation error: l6220e: load region LR_ IROM1 size (65552 bytes) exceeds limit (65536 bytes). Region contains 84 bytes of padding and 0 bytes of veneers (total 84 bytes of linker generated content).


resolvent:

Step 1

For 128K chips, modify the irom1 size to 0x20000 (in the red box below). Some versions of Keil will automatically change this location when you change the device; Some versions need to be modified manually

Step 2

Select linker → edit to open link.sct file

Modify the data after LR_IROM1 and ER_IROM1 in the file to 0x20000 (at the red box in the figure below) and save the file.

Step 3

Recompile and solve the problem

Tips

The first and second steps must be completed before compiling and testing. The first step alone may not be successful.

[Solved] cortex_M3 freeRTOS Error: undefined reference to `_sbrk‘

Background: When cortex_m3 uses FreeRTOS to enable the running time statistics function.

Compilation error during compilation:

/Data/user_ Home//build_ Tools/GCC arm none eabi-/bin// Lib/gcc/arm-none-eabi/6.2.1/../../../../..// Arm-none-eabi/lib/thumb/v7-m/libc A (lib_a-sbrkr.o): in function`_ Sbrk_ R’:

Sbrkr c: (.Text.\u sbrk_r+0xc): undefined reference to`_ Sbrk’

Collect2: error: LD returned 1 exit status

Makefile:155: recipe for target’all’failed

Make: * * * [all] error 1


Cause: by default, arm GCC uses startfiles, which results in link compilation failure when calling some functions (malloc, free, sprintf…) that are not implemented at the bottom.

Promotion: if the compiler reports Error: undefined reference to `_sbrk’ `_read’ `_write’ `_lseek’ `_isatty’ `_fstat’ , it is the same reason.


Solution:

Method 1: if the project does not need these functions, find the direct mask function.

Method 2: once and for all. The link fails because these functions are not implemented, so you can rewrite these underlying functions or add library files with these functions, such as libnosys a. Add compilation parameter —specs=nosys.specs can be used.

After adding, if the compiler reports the following errors:

/Data/user_ Home/ /build_ Tools/GCC arm none eabi-/bin// Lib/gcc/arm-none-eabi/6.2.1/../../../../..// Arm-none-eabi/lib/thumb/v7-m/libnosys A (sbrk.o): in function`_ Sbrk’:

Sbrk c: (.Text.\u sbrk+0x18): undefined reference to `end’

Collect2: error: LD returned 1 exit status

Makefile:155: recipe for target’all’failed

Make: * * * [all] error 1

This is because the ‘end’ symbol is not defined in the .lds linker script, so find the project’s xx.lds file to set that script for the heap location, e.g.

  .heap :

  {

    . = ALIGN(4);

    __HEAP_START = .;

    . += 0x2000; __HEAP_MAX = .;

    end = __HEAP_MAX;

     PROVIDE(end = .);

  } > ram

[Solved] Keil Error: ST-LINK USB communication error

Keil Error: ST-LINK USB communication error

Today, when downloading the program with stlink-v2, there was st-link USB communication error. This problem suddenly appeared. I found many solutions on the Internet, but they can’t be used. My solutions are given below for reference only.

If there is a problem as shown in the figure below:

We can solve this problem by re brushing the firmware. you can download the stlink online.

It is very easy to upgrade the firmware of ST-Link. If the ST-Link can be used normally, please do not come to upgrade easily. Here you can open our ST-Link package, there is a zip package inside: ST-Link firmware upgrade software.zip, you can see after decompression.

For windows computers, we go directly to the windows folder and click ST-LinkUpgrade.exe:

The opened interface is as follows:

At this time, we need to connect st link to the computer through USB. After connecting, click the device connect button on the interface,
if the connection is successful, the prompt message in the following interface will appear:

Note: if an error is reported when brushing firmware: Communication error with ST-Link .Try to start it. We can solve this problem by unplugging stlink and then continuing to update the firmware

Eclipse Godson Error: Makefile:recipe for target ‘clean‘ failed

report errors

Error in environment when running Godson development in Eclipse:
Godson makefile: 66: recipe for target 'clean' failed
makefile: 66: recipe for target 'clean' failed
makefile: recipe for target 'clean' failed

Error reporting reason

Reason one

Error making when writing kernel module. When the error message “recipe for target XXX” is still displayed after the syntax error and path error of makefile are eliminated, maybe you should doubt the code used by your makefile. (if your makefile is copied directly from the Internet, first use the WordPad under the window to see if there is any garbled code. The garbled code of “space” is likely to lead to your error)

reason

If you do not run as an administrator under windows10 system, the above error will be reported

Solution:

Run eclipse as an administrator and run the files will be OK!

[Solved] keil arm_math Error: error:  #35: #error directive: “Define according the used Cortex cor

Import arm_math file and compile error:

..\application\arm_math.h(306): error:  #35: #error directive: "Define according the used Cortex cor

 

Solution: Add the following global macro definition
USE_HAL_DRIVER,STM32F407xx,ARM_MATH_CM4,__FPU_USED=1U,__FPU_PRESENT=1U,__CC_ARM,ARM_MATH_MATRIX_CHECK,ARM_MATH_ROUNDING

How to Solve Hdsc32 MDK compile error: #29 & #223-D

1. error: #29: expected an expression

1. Error in compiling the following statement
for(int i=0; i<16; i++)
2. MDK uses C90 by default. It can support C99 after configuration. Modify it according to the following figure

2. error: #223-D: function “BSP_CLK_Init” declared implicitly

F460:
After initializing the BSP_CLK_Init function in main.c and calling it in the main function, this error is reported, indicating that the declaration is not legal.

Referring to the following article, I made a declaration at the beginning of main.c to call extern void BSP_CLK_Init(void);

after which the error disappears.