Tag Archives: Embedded hardware

Jetson MONAILabel(arm) Failed to Run distributed Module [How to Solve]

Solution:

  • https://forums.developer.nvidia.com/t/pytorch-for-jetson/72048
  • Switch the version to v1.11.0
  • Then install the distributed development package
  • sudo apt get install python3 pip libopenblas base libopenmpi dev libomp dev

Verification:

Cause analysis:

It is possible to call distributed modules in v1.11.0. Maybe there is something wrong with the official whl compilation in the new version

[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

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

Matlab Raspberry Pi Error: External Mode Open Protocol Connect command failed

External Mode Open Protocol Connect command failed
Caused by:
The model that you are trying to run in External mode does not match the application running on your target. Checksum test (OPEN_PROTOCOL) failed. The host model’s structural checksum is [2526462847, 2787246958, 279442647, 1167683516] and the target application’s structural checksum is [3758715623, 2604559863, 3074017724, 3602092489]. Rebuild the model, run it on your target, and start External mode simulation again.
Component:Simulink | Category:Block diagram error
Unable to connect to the ‘Raspberry Pi’ target for

 

Solution: Delete the related files of the model in the Raspberry Pi
(1) View the file directory

ls /home/pi/

(2) Open the matlab file directory in the raspberry pie

cd MATLAB_ws/R2020b

(3) Delete the elf and log related to the model
for example:

rm -f CANComm_Gear_control.log

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.

MPU6050 initialize failure [How to Solve]

1. 6050 initialization failed

If 6050 fails to initialize, first check whether the read address is wrong

res=MPU_Read_Byte(MPU_DEVICE_ID_REG);
	printf("mpu addr=%x\r\n",res);
	if(res==MPU_ADDR)//Device ID is correct
	{
		MPU_Write_Byte(MPU_PWR_MGMT1_REG,0X01); //set CLKSEL,PLL X-axis as reference
		MPU_Write_Byte(MPU_PWR_MGMT2_REG,0X00); //Acceleration and gyroscope both work
		MPU_Set_Rate(50); //Set the sampling rate to 50Hz
 	}
	else return 1;

I read out here is 0x68, different connection will also lead to different ID, if the address is correct, that is return 0, here for the initialization of the 6050 initialized through.

2, mpu initialization failure
Mpu initialization failure is common to return error code 8, you can step by step into the source code to analyze.

Solution I.
mpu_dmp_init() -> run_self_test() Here is the self-test, jump into the function can be seen, meaning that it needs to be placed horizontally in order to self-test successfully, so only the module can be placed horizontally, if not directly mask this part of the code can be.

Solution two.
Trace the source code: mpu_dmp_init() -> run_self_test() -> mpu_run_self_test(gyro, accel) -> accel_self_test(accel, accel_st)

Both the initialization is successful only when the absolute value of st_shift_var < the value of test.max_accel_var. And the absolute value of st_shift_var is different for different positions of MPU6050 modules. Only when the module is placed horizontally, the absolute value of st_shift_var is closest to the value of test.max_accel_var, if this parameter is not modified, the module needs to be placed horizontally according to method 1 for testing

Here you can print out the absolute value of st_shift_var and the value of test.max_accel_var when debugging, my solution here is to change the initialization value of test.max_accel_var from 0.14 to 0.16. Then the module will be initialized successfully when the module is placed horizontally. This is shown in the figure below:

3. Initialization passed, but the data is 0

Another situation is that all initialization passes, but the Euler angle data is all 0. This situation is because there is a hard delay in the code or the processing of other modules affects 6050, so the data is all 0. The personal test is to mask the data processing screen of a module after the test.

[Solved] No corresponding flash error is found during MDK download

1. There is no stmf10x 128K flash model in keilmdk

2. Go to keil’s official website to download the DFP package of the corresponding model

you can download the latest installation package
3. Put the downloaded DFP into the Keil installation directory, (you can leave it alone. The installation path of the pack package is the default and cannot be changed)

4. After installation, you need to put the. FLM file in the downloaded package under this path

5. The. FLM file cannot be found in the downloaded DFP. You need to copy the. FLM file in
G:\keil\arm\pack\keil\stm32f1xx_df\2.4.0\flash

copy the copied file Put the parts into storage
in FLM package
G:\keil\arm\flash

then restart keil OK