Здравствуй!!! На работе руководством было принято стратегическое решение о переходе на процы STM8 взамен Атмела. Я в свою очередь решил юзать стандартную STMовскую библиотеку. Но в первом же проекте наткнулся на ошибку, которая по-ходу выше моих программерских познаний (см. ниже). Поиск по форуму и гуглу не помогли.
Смысл в следующем: при попытке прикрутить поверх стандартной либы свою библиотеку UART с использованием очереди (или циклического буфера) наткнулся на ошибку линковщика [Li005]. А именно в момент прописывания обработчика прервыния по завершению передачи UART в файле «stm8s_it.c».
Вот выдержки из всех файлов, которые на мой взгляд нужны для помощи мне))):
Файл main.c
#include "main.h"
#include "stm8s.h"
#include "stdio.h"
#include "uart.h"
void main(void)
{
UART_init();
UART_SendStr("test");
while(1);
}
Файл uart.h
#include "stm8s.h" #define UART_SPEED 115200 #define UART_GPIO_PINS (GPIO_PIN_6 | GPIO_PIN_5) #define SIZE_BUF 256 void UART_init(void); __monitor void UART_PutChar(uint8_t sym); void UART_SendStr(uint8_t * data);
Файл uart.c
#include "uart.h"
static volatile uint8_t uartTxBuf[SIZE_BUF];
static uint16_t txBufHead = 0;
static volatile uint16_t txCount = 0;
void UART_init(void)
{
UART2_DeInit();
UART2_Init((uint32_t)UART_SPEED, UART2_WORDLENGTH_8D, UART2_STOPBITS_1, UART2_PARITY_NO,
UART2_SYNCMODE_CLOCK_DISABLE, UART2_MODE_TXRX_ENABLE);
UART2_ITConfig(UART2_IT_TC, ENABLE);
UART2_ITConfig(UART2_IT_RXNE_OR, ENABLE);
enableInterrupts();
}
__monitor void UART_PutChar(uint8_t sym)
{
if((UART2_GetFlagStatus(UART2_FLAG_TXE) == RESET) && (txCount == 0))
UART2_SendData8(sym);
else
{
if (txCount < SIZE_BUF)
{
uartTxBuf[txBufTail] = sym;
txCount++;
txBufTail++;
txBufTail = txBufTail % SIZE_BUF;
}
}
}
void UART_SendStr(uint8_t * data)
{
uint8_t sym;
while(*data)
{
sym = *data++;
UART_PutChar(sym);
}
}
Файл stm8s_it.c
#include "stm8s_it.h"
#include "uart.h"
extern uint8_t uartTxBuf[SIZE_BUF];
extern uint16_t txBufHead;
extern uint16_t txCount;
INTERRUPT_HANDLER(UART2_TX_IRQHandler, 20)
{
if (txCount > 0)
{
UART2_SendData8(uartTxBuf[txBufHead]);
txCount--;
txBufHead++;
if (txBufHead == SIZE_BUF)
txBufHead = 0;
}
}
При компиляции IAR выдает следующее:
Error[Li005]: no definition for "txCount" [referenced from F:SOURSESST135STM8S_StdPeriph_Lib_V2.1.0ProjectSTM8S_StdPeriph_TemplateEWSTM8STM8S105Objstm8s_it.o] Error[Li005]: no definition for "txBufHead" [referenced from F:SOURSESST135STM8S_StdPeriph_Lib_V2.1.0ProjectSTM8S_StdPeriph_TemplateEWSTM8STM8S105Objstm8s_it.o] Error[Li005]: no definition for "uartTxBuf" [referenced from F:SOURSESST135STM8S_StdPeriph_Lib_V2.1.0ProjectSTM8S_StdPeriph_TemplateEWSTM8STM8S105Objstm8s_it.o] Errors: 3 Warnings: none Link time: 0.08 (CPU) 0.10 (elapsed) Error while running Linker Total number of errors: 3 Total number of warnings: 0
В общем не нравятся ему переменные в файле stm8s_it.c которые объявлены в файле uart.c хотя я и объявил их как extern.
Что бы не было вопросов «включен ли файл в проект»:
IAR 6.1.6.1880 (6.1.6.1880), проц STM8S105
Заранее благодарен.
Теги: IAR Li005 __iar_program_start
вперед из:http://www.51hei.com/stm32/3615.html
Error[Li005]: no definition for «__iar_program_start» [program entry]
IAR 6.3 Стандартная библиотека STM32 3.5. После компиляции вы не можете изменить проверку ошибки. Вам необходимо изменить следующие настройки.
Использовать нормальный или полный
Это должно быть отмечено
Интеллектуальная рекомендация
Жадный алгоритм
Эта статья относится к книге «Графический алгоритм» Во-первых, прежде чем понимать жадный алгоритм, сначала нужно понятьNP полная проблема Полная проблема NP (проблема NP-C) является одной и…
Многопоточный
Обязательное выполнение не выполняется, как и ожидалось 1. Причиной каждого принуждения является новый NW () поток 2. Он выполняется одновременно перед разрезанием Решите код…
ssh localhost ( )
ssh locahost , , test, test, 1 ssh localhost: $ ssh localhost Вывод выглядит следующим образом: 2 ssh localhost, : $ ssh-keygen -t dsa -P » -f ~/.ssh/id_dsa $ cat ~/.ssh/id_dsa.pub >> ~/.ssh/au…
Вам также может понравиться
Ifeq Multi -Condition в makefile
Ifeq Multi -Condition в makefile 21 августа 2015 г. 20:14:23liwugang43210Количество чтения 42340 Заявление об авторском праве: эта статья является оригинальной статьей блоггеров. Если вы переиздаете, …
socket API(linux)
функция 1.socket (1) определение Роль: Создать сокет (2) Параметры domain Установка домена сети связи, то есть настройки протокола связи: имя имея в виду AF_UNIX, AF_LOCAL Местная связь AF_INET …
I am having a strange problem. I am trying to integrate the spi module from Nordic Semiconductors peripherals examples with the Central BLE Uart project.
There is a library of component common to all the examples. So what I did is add the spi_slave file nrf_drv_spis.c to my project, and added the path to that component in the preprocessor paths of the project.
$PROJ_DIR$..............componentsdriversnrf_spi_slave is in my preprocessor paths and this is where nrf_drv_spis.c and nrf_drv_spis.h are.
However, when I compiled the code, I get this error
Error[Li005]: no definition for "nrf_drv_spis_init" [referenced from D:Repoble_projectsnRF5_SDK_12.3.0examplesble_centralble_app_uart_cpca10028s130iar_buildmain.o]
nrf_drv_spis_init is a function found in nrf_drv_spis.c and the prototype is in nrf_drv_spis.h. The odd thing as well is that when I right click on nrf_drv_spis_init and «go to the definition», it always bring me to the prototype in the header file. Normally, IAR presents me with either the prototype or the definition of the function and I need to click either the declaration or the prototype.
So it does shows me that for whatever reason, the file nrf_drv_spis.c doesn’t seem to be in the project, but I don’t know what to do to fix this.
Any help would be appreciated.
Thanks.
Hello,
I tried copying code from twi_sensor example to ble_app_uart and got this error:
Error[Li005]: no definition for "nrf_drv_twi_init" [referenced from W:MODIFIED_SDK_13.0.0_04a0bfdexamplesble_peripheralflipdot_fw301pca10040s132iar_buildmain.o]
What’s weird in this case is that all the includes necessary for function nrf_drv_twi_init have been added to main.c and if I tried Go To Definition of nrf_drv_twi_init (which seems to be located in nrf_drv_twi.h) I would find it without any problems.
Link to the project: github.com/…/flipdot_fw301
-
Hi,
Seems like you have not added the file
nrf_drv_twi.cto your project.Right click on the folder nRF_Drivers -> Add -> Add Files…, and add
nrf_drv_twi.c. That should solve the problem. -
Thank you, that fixed it!
-
what if below error is come
Error[Li005]: no definition for «ble_advertising_on_ble_evt» [referenced from D:Himanshunrf 51822documentsnRF5_SDK_12.0.0_12f24dasdk_ble_firmexamples
-
See the Verified Answer above — you need to add the .c file which contains the definition of the ble_advertising_on_ble_evt() function.
if I tried Go To Definition of nrf_drv_twi_init (which seems to be located in nrf_drv_twi.h) I would find it without any problems.
That is finding a declaration — the function prototype — not its definition.
This is standard ‘C’ stuff — nothing specifically to do with Nordic or IAR:
http://c-faq.com/decl/decldef.html
-
where i found that .c file?? please send me a link
advise (07.12.2011 00:07, просмотров: 12739)
Вопрос по IAR ARM 6.30 попробовал сделать в нем проект . программа состоит из двух строк main , а внутри return 0 сделал настройки и попробовал откомпелировать , выдает ошибку Error[Li005]: no definition for «__iar_program_start» [program entry] нашел в настройка linker вкладка library можно поставить галочку напротив __iar_program_start все равно выдает ошибку.Чего IAR от меня хочет?



