cancel
Showing results for 
Search instead for 
Did you mean: 

printf stop working after including one more header file. No functions called yet into the new associated c file

Marius CO
Associate III

I have ST452LE. Code for HAL from Cube MX.

All working fine. The program hex is 50k.

I am just adding another line to main.c

#include "newfile.h" and have the newfile.c int he project.

I am not calling any functions yet into the newfile.c.

Upon flashing all printf's stop working.

41540     1368     6976    49884     c2dc   stm452.elf (with the new c file in the folder of the project)

39632     1364     6972    47968     bb60   stm452.elf (without)

```

#include "tca9648.h"

//#include "tla2024.h" //Size         : 41008 Bytes WITHOUT

                  //Size         : 42920 Bytes WITH the c file in project

```

I get no errors, or issues compiling, flashing or running, but the __io_putchar wont get called anymore. These printf's are before

starting the rtos kernel right after initializing the UART in the main

function.

 LD file:

 MEMORY

{

RAM (xrw)     : ORIGIN = 0x20000000, LENGTH = 160K

FLASH (rx)     : ORIGIN = 0x8000000, LENGTH = 512K

}

 RTOS config

#define configUSE_PREEMPTION                    1

#define configSUPPORT_STATIC_ALLOCATION         1

#define configSUPPORT_DYNAMIC_ALLOCATION        1

#define configUSE_IDLE_HOOK                     0

#define configUSE_TICK_HOOK                     0

#define configCPU_CLOCK_HZ                      ( SystemCoreClock )

#define configTICK_RATE_HZ                      ((TickType_t)1000)

#define configMAX_PRIORITIES                    ( 7 )

#define configMINIMAL_STACK_SIZE                ((uint16_t)128)

#define configTOTAL_HEAP_SIZE                   ((size_t)3000)

#define configMAX_TASK_NAME_LEN                 ( 16 )

#define configUSE_16_BIT_TICKS                  0

#define configUSE_MUTEXES                       1

#define configQUEUE_REGISTRY_SIZE               8

#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1

Any idea where to look.

Thank you

1 REPLY 1
Marius CO
Associate III

I found it.

I had 2 functions in the new C files called

uint16_t _write(uint8_t reg_addr)
 
uint16_t _read(uint8_t reg_addr)
 
 

Just renamed them.

// I had this function
 
uint16_t _write(uint8_t reg_addr)
{
	_data.value = 0;
	i2c_readbytes(I2C_BUS_NO, _dev_addr, reg_addr,  _data.packet, 2);
	return _data.value;
}
 
// weak function overload collision.....
 
static int _local_write(uint8_t reg_addr)
{
	_data.value = 0;
	i2c_readbytes(I2C_BUS_NO, _dev_addr, reg_addr,  _data.packet, 2);
	return _data.value;
}