Tag Archives: singlechip

[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] STM8L151 IAR Project Compile Error: Fatal Error[Pe035]: #error directive: “Please select first the target STM8L…

Project scenario:

STM8L151G4XX MCU IAR engineering compilation error


Problem description

Fatal Error[Pe035]: #error directive: “Please select first the target STM8L device used in your application (in stm8l15x.h file)”
Open stm8l15x.h, and we can see the following code:

#if !defined (STM8L15X_MD) && !defined (STM8L15X_MDP) && !defined (STM8L15X_HD) && !defined (STM8L15X_LD) \
&& !defined (STM8L05X_LD_VL) && !defined (STM8L05X_MD_VL) && !defined (STM8L05X_HD_VL) && !defined (STM8AL31_L_MD)
 #error "Please select first the target STM8L device used in your application (in stm8l15x.h file)"
#endif
/* Uncomment the line below according to the target STM8L15x device used in your
   application
  */
/* #define STM8L15X_LD */     /*!< STM8L15X_LD: STM8L15x Low density devices */
/* #define STM8L15X_MD */     /*!< STM8L15X_MD: STM8L15x Medium density devices */
/* #define STM8L15X_MDP */    /*!< STM8L15X_MDP: STM8L15x Medium density plus devices */
/* #define STM8L15X_HD */     /*!< STM8L15X_HD: STM8L15x/16x High density devices */
/* #define STM8L05X_LD_VL */  /*!< STM8L05X_LD_VL: STM8L051xx3 Low density value line devices */
/* #define STM8L05X_MD_VL */  /*!< STM8L05X_MD_VL: STM8L052xx6 Medium density value line devices */
/* #define STM8L05X_HD_VL */  /*!< STM8L05X_HD_VL: STM8L052xx8 High density value line devices */
/* #define STM8AL31_L_MD */   /*!< STM8AL31_L_MD: STM8AL3x Medium density devices */


/*  Tip: To avoid modifying this file each time you need to switch between these
        devices, you can define the device in your toolchain compiler preprocessor.

 - Low density STM8L15x devices are STM8L151C3, STM8L151K3, STM8L151G3, STM8L151F3,
   STM8L151C2, STM8L151K2, STM8L151G2 and STM8L151F2 microcontrollers where the 
   Flash memory density ranges between 4 and 8 Kbytes.
 - Medium density STM8L15x devices are STM8L151C4, STM8L151C6, STM8L152C4,
   STM8L152C6, STM8L151K4, STM8L151K6, STM8L152K4, STM8L152K6, STM8L151G4,
   STM8L151G6, STM8L152G4 and STM8L152G6 microcontrollers where the Flash memory
   density ranges between 16 and 32 Kbytes.
 - Medium density Plus devices are STM8L151R6, STM8L152R6 microcontrollers where
  the Flash memory density is fixed and equal to 32 Kbytes and a wider range of
  peripheral than the medium density devices.
 - High density STM8L15x devices are STM8L151x8, STM8L152x8, STM8L162R8 and STM8L162M8
   microcontrollers where the Flash memory density is fixed and equal to 64 Kbytes with 
   the same peripheral set than Medium Density Plus devices.
 - Value line low density STM8L05xx devices are STM8L051x3 microcontrollers
   with 8-KB Flash
 - Value line medium density STM8L05xx devices are STM8L052x6 microcontrollers 
   with 32-KB Flash
 - Value line high density STM8L05xx devices: STM8L052x8 microcontrollers
   with 64-KB Flash
 - Medium density STM8AL31xx/STM8AL3Lxx devices: STM8AL3168, STM8AL3166, 
   STM8AL3148,STM8AL3146, STM8AL3138, STM8AL3136, STM8AL3L68, STM8AL3L66, 
   STM8AL3L48, STM8AL3L46 microcontrollers with 8-KB, 16-KB or 32-KB Flash
 */

Solution:

Method 1:
Modify directly in the stm8l15x.h file, delete the comment symbols of the macro definition needed, take STM8L151G4XX as an example, according to the above description, the model belongs to Medium density.

/* Uncomment the line below according to the target STM8L15x device used in your
   application
  */
/* #define STM8L15X_LD */     /*!< STM8L15X_LD: STM8L15x Low density devices */
 #define STM8L15X_MD   		/*!< STM8L15X_MD: STM8L15x Medium density devices */
/* #define STM8L15X_MDP */    /*!< STM8L15X_MDP: STM8L15x Medium density plus devices */
/* #define STM8L15X_HD */     /*!< STM8L15X_HD: STM8L15x/16x High density devices */
/* #define STM8L05X_LD_VL */  /*!< STM8L05X_LD_VL: STM8L051xx3 Low density value line devices */
/* #define STM8L05X_MD_VL */  /*!< STM8L05X_MD_VL: STM8L052xx6 Medium density value line devices */
/* #define STM8L05X_HD_VL */  /*!< STM8L05X_HD_VL: STM8L052xx8 High density value line devices */
/* #define STM8AL31_L_MD */   /*!< STM8AL31_L_MD: STM8AL3x Medium density devices */

Method 2:
Set the path: Options->C/C++ Compiler->Preprocessor-Defined symbols

[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] 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 J-link Error (Two Command Errors & Solution)

1. The JLINK driver version is too high, resulting in the identification that the JLINK tool is pirated

error reported: the connected probe appears to be a j-link clone

1. Uninstall the high version JLINK driver. The version here is 7.6

find the jink driver installation directory and click Remove J-Link V7.64b

2. Install j-link version 6. X driver

download address: segger – the embedded experts – Downloads – j-link/J-TRACE

install directly after downloading

3. Change the j-link driver under MDK5 to a lower version

find the newly installed JLINK driver installation directory. The default is: C:\Program Files (x86)\SEGGER\JLink_V640b

find jlinkarm.dll file, replace this file under mdk5, and the directory under mdk5 is: ..\MDK528\ARM\Segger

reopen mdk5 and connect the development board to JLINK. At this time, you can view that the JLINK driver version is updated successfully</ font>

2. JLINK chip locked

error reported: JLINK error: could not find core in coresight setup 

found in JLINK installation directory: JLINK.exe

enter after opening:

unlock kinetis

if the connection fails, connect the reset pin on the JLINK download tool and GND to perform the chip burning reset operation. Repeat it several times and it will succeed

[Solved] KEIL Error: keil Error: failed to execute ‘C:\Keil\ARM\ARMCC‘

 

Question:

keil Error: failed to execute ‘C:\Keil\ARM\ARMCC’

Cause of problem:

route:

.\MDK_ARM\ARM

Kiel ARM compiler is missing:

Because the latest version of Keil installation directory does not support ARMCC, that is, version 5 cannot be used

Solution:

1. Download the old version of keil

2. Right click to unzip the file, and put the file into the folder where the new version of ARM is installed

3. Add this folder

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] 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.