2021-02-25 04:51 AM
Hi I've been working on a simple project with the STM8L152R8 but recently I've run into a problem I cant get around.
When building with cosmic compiler I'm getting the follwing error:
'#error clnk Debug\test_gpio_uart.lkf:1 segments .const (0x8080-0x8118) and .const (0x8000-0x808d) overlap'
I can see in the linker that the vector table starts at 0x8000 and the main code segment starts at 0x8080
# Segment Code,Constants:
+seg .const -b 0x8080 -m 0xff80 -n .const -it
+seg .text -a .const -n .text
#<BEGIN VECTOR_FILE>
+seg .const -b 0x8000 -k
Debug\stm8_interrupt_vector.o
If I change the start address of the code from 0x8080 to 0x8090 it compiles okay but when I run the program nothing happens - I guess theres somewhere else I need to update the start address?
Apart from that why would my interrupt segment have overran its segment. I've tried removing everything in the 'stm8l15x_it.c' file and changed the handlers for interrupts I dont care about to 'NonHandledInterrupt' but I'm still getting the error.
Here is my 'stm8_interrupt_vector.c' file:
/* BASIC INTERRUPT VECTOR TABLE FOR STM8 devices
* Copyright (c) 2007 STMicroelectronics
*/
#include "stm8l15x_it.h"
typedef void @far (*interrupt_handler_t)(void);
struct interrupt_vector {
unsigned char interrupt_instruction;
interrupt_handler_t interrupt_handler;
};
/*@far @interrupt void NonHandledInterrupt (void)
{
/* in order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction
return;
}*/
//extern void _stext(); /* startup routine */
struct interrupt_vector const _vectab[] = {
{0x82, (interrupt_handler_t)_stext}, /* Reset */
{0x82, (interrupt_handler_t)TRAP_IRQHandler}, /* TRAP - Software interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* Reserved */
{0x82, (interrupt_handler_t)FLASH_IRQHandler}, /* irq1 - FLASH interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq2 - DMA1 channel0 and channel1 interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq3 - DMA1 channel2 and channel3 interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq4 - RTC/ CSS on LSE interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq5 - External IT PORTE/F interrupt /PVD interrupt*/
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq6 - External IT PORTB / PORTG interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq7 - External IT PORTD / PORTH interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq8 - External IT PIN0 interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq9 - External IT PIN1 interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq10 - External IT PIN2 interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq11 - External IT PIN3 interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq12 - External IT PIN4 interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq13 - External IT PIN5 interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq14 - External IT PIN6 interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq15 - External IT PIN7 interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq16 - LCD / AES interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq17 - CLK switch/CSS interrupt/ TIM1 Break interrupt / DAC */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq18 - ADC1 and Comparator interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq19 - TIM2 Update/Overflow/Trigger/Break / USART2 TX interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq20 - TIM2 Capture/Compare / USART2 RX interrupt */
{0x82, (interrupt_handler_t)TIM3_UPD_OVF_TRG_BRK_USART3_TX_IRQHandler}, /* irq21 - TIM3 Update/Overflow/Trigger/Break / USART3 TX interrupt */
{0x82, (interrupt_handler_t)TIM3_CC_USART3_RX_IRQHandler}, /* irq22 - TIM3 Capture/Compare /USART3 RX interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq23 - TIM1 Update/Overflow/Trigger/Commutation interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq24 - TIM1 Capture/Compare interrupt */
{0x82, (interrupt_handler_t)TIM4_UPD_OVF_TRG_IRQHandler}, /* irq25 - TIM4 Update/Overflow/Trigger interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq26 - SPI1 interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq27 - USART1 TX / TIM5 Update/Overflow/Trigger/Break interrupt */
{0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq28 - USART1 RX / TIM1 Capture/Compare interrupt */
{0x82, (interrupt_handler_t)I2C1_SPI2_IRQHandler}, /* irq29 - I2C1 / SPI2 interrupt */
};
Any help would be appreciated.
Thanks,
2021-03-03 03:21 AM
Not sure wjat the issue was here but I created a new project and copied the code over bit by bit and didnt see the problem again.