Comments (21)
Hi, thank you for your interest in LibCSP.
We are using csp with FreeRTOS 8.0 currently. There is a define called FREERTOS_VERSION, try setting that to 8. Some of the system calls to freertos has changed from version 7 to version 8.
Otherwise you should post your build output and your configure command.
from libcsp.
Hello,
I had made search for define in whole libcsp-1.2 folder, but didn't find suggested define. I tried to insert in main file, but also not helped.
I Used
./waf configure --toolchain=arm-none-eabi- --with-os=freertos --with-freertos=/home/klasteris/Desktop/FreeRTOSV8.1.2/FreeRTOS/Source/include
Without any interfaces yet. At beginning where was mistakes, because libcsp-1.2 searched header files in different places, but it is quick to fix.
building with ./waf buil install. and csp_autoconf.h
/* WARNING! All changes made to this file will be lost! */
#ifndef _INCLUDE_CSP_CSP_AUTOCONFIG_H_WAF
#define _INCLUDE_CSP_CSP_AUTOCONFIG_H_WAF
#define GIT_REV "unknown"
#define CSP_FREERTOS 1
/* #undef CSP_POSIX */
/* #undef CSP_WINDOWS */
/* #undef CSP_MACOSX */
#define CSP_DEBUG 1
#define CSP_VERBOSE 1
/* #undef CSP_USE_RDP */
/* #undef CSP_USE_CRC32 */
/* #undef CSP_USE_HMAC */
/* #undef CSP_USE_XTEA */
/* #undef CSP_USE_PROMISC */
/* #undef CSP_USE_QOS */
#define CSP_CONN_MAX 10
#define CSP_CONN_QUEUE_LENGTH 100
#define CSP_FIFO_INPUT 10
#define CSP_MAX_BIND_PORT 31
#define CSP_RDP_MAX_WINDOW 20
#define CSP_PADDING_BYTES 8
#define CSP_LOG_LEVEL_DEBUG 1
#define CSP_LOG_LEVEL_INFO 1
#define CSP_LOG_LEVEL_WARN 1
#define CSP_LOG_LEVEL_ERROR 1
#define CSP_LITTLE_ENDIAN 1
/* #undef CSP_BIG_ENDIAN */
#define CSP_HAVE_STDBOOL_H 1
#endif /* _INCLUDE_CSP_CSP_AUTOCONFIG_H_WAF */
Also Freertosconfig.h is
#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0
#define configCPU_CLOCK_HZ ( ( unsigned long ) 160000000 )
#define configTICK_RATE_HZ ( ( portTickType ) 100 )
//#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )
#define configMAX_PRIORITIES ( 5 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 256 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 8 * 1024 ) )
#define configMAX_TASK_NAME_LEN ( 16 )
#define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 8
#define configCHECK_FOR_STACK_OVERFLOW 0
#define configUSE_RECURSIVE_MUTEXES 1
#define configUSE_MALLOC_FAILED_HOOK 0
#define configUSE_APPLICATION_TASK_TAG 0
#define configUSE_COUNTING_SEMAPHORES 1
#define configGENERATE_RUN_TIME_STATS 0
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( 2 )
#define configTIMER_QUEUE_LENGTH 10
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 1
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#ifdef __NVIC_PRIO_BITS
#define configPRIO_BITS __NVIC_PRIO_BITS
#else
#define configPRIO_BITS 4 /* 15 priority levels */
#endif
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
#define vPortSVCHandler SVC_Handler
#define xPortPendSVHandler PendSV_Handler
#define xPortSysTickHandler SysTick_Handler
#endif /* FREERTOS_CONFIG_H */
main.c is simple blinkink leds on stm32f4discovery with some data output through usart. csp_init is commented, because it's not compiling. code works on MCU board without csp_init.
#include "stm32f4xx.h"
#include "stm32f4xx_rcc.h"
#include "stm32f4xx_gpio.h"
#include <stdio.h>
#include <string.h>
#include "usart_radio.h"
#include "stm32f4_discovery.h"
/* Kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#include "semphr.h"
/* CSP CubeSat Space Protocol */
#include "csp/csp.h"
/* LEDs Init & UART Init*/
void HwInit( void );
void vTask1( void *pvParameters );
void vTask2( void *pvParameters );
/** Example defines */
#define MY_ADDRESS 1 // Address of local CSP node
#define MY_PORT 10 // Port to send test traffic to
int main(void) {
HwInit();
usart_radio_send("Initialising CSP\r\n");
csp_buffer_init(5, 300);
//csp_init(MY_ADDRESS);
xTaskCreate( vTask1, (const char*)"Task 1", 200, NULL, 1, NULL );
xTaskCreate( vTask2, (const char*) "Task 2", 200, NULL, 1, NULL );
vTaskStartScheduler(); // This should never return.
while (1) {
}
}
void vTask1( void *pvParameters ){
for( ;; ) {
STM_EVAL_LEDToggle(1);
usart_radio_send("Task 1 running\n");
vTaskDelay(500);
}
}
void vTask2( void *pvParameters ) {
for( ;; ) {
STM_EVAL_LEDToggle(3);
usart_radio_send("Task 2 running\n");
vTaskDelay(100);
}
}
void HwInit( void ) {
GPIO_InitTypeDef GPIO_InitStructure1;
USART_InitTypeDef USART_InitStructure1;
STM_EVAL_LEDInit(0);
STM_EVAL_LEDInit(1);
STM_EVAL_LEDInit(2);
STM_EVAL_LEDInit(3);
STM_EVAL_LEDOn(0);
STM_EVAL_LEDOn(2);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_UART4, ENABLE);
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
GPIO_InitStructure1.GPIO_Pin = GPIO_Pin_1;
GPIO_InitStructure1.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure1.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure1.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure1.GPIO_PuPd = GPIO_PuPd_UP ;
GPIO_Init(GPIOA, &GPIO_InitStructure1);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource1, GPIO_AF_UART4);
GPIO_InitStructure1.GPIO_Pin = GPIO_Pin_0;
GPIO_InitStructure1.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure1.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure1.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure1.GPIO_PuPd = GPIO_PuPd_UP ;
GPIO_Init(GPIOA, &GPIO_InitStructure1);
GPIO_PinAFConfig(GPIOA, GPIO_PinSource0, GPIO_AF_UART4);
USART_InitStructure1.USART_BaudRate = 9600;
USART_InitStructure1.USART_WordLength = USART_WordLength_8b;
USART_InitStructure1.USART_StopBits = USART_StopBits_1;
USART_InitStructure1.USART_Parity = USART_Parity_No;
USART_InitStructure1.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure1.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_Init(UART4, &USART_InitStructure1);
USART_Cmd(UART4, ENABLE);
}
void vApplicationMallocFailedHook( void ) {
for( ;; );
}
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ) {
for( ;; );
}
void vApplicationIdleHook( void ) {
}
void vApplicationTickHook( void ){
}
from libcsp.
I Found define when I have downloaded libcsp-master.zip archive in csp_thraed.h file. but changes not helped also.
from libcsp.
Well, you need to find out why it's not compiling, please post the compiler output too.
from libcsp.
Sorry I forgot. here it is
10:12:22 **** Incremental Build of configuration Debug for project CSP_FreeRTOS ****
make all
'Building target: CSP_FreeRTOS.elf'
'Invoking: Cross ARM C Linker'
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -g3 -T "C:\Users\Raima\workspace\CSP_FreeRTOS\ldscripts\stm32_flash.ld" -Xlinker --gc-sections -L"C:\Users\Raima\workspace\CSP_FreeRTOS\ldscripts" -Xlinker -specs=nosys.specs -Wl,-Map,"CSP_FreeRTOS.map" -o "CSP_FreeRTOS.elf" ./src/app.o ./src/startup_stm32f4xx.o ./src/stm32f4_discovery.o ./src/system_stm32f4xx.o ./src/usart_radio.o ./libcsp-1.2/src/transport/csp_rdp.o ./libcsp-1.2/src/transport/csp_udp.o ./libcsp-1.2/src/interfaces/csp_if_lo.o ./libcsp-1.2/src/crypto/csp_hmac.o ./libcsp-1.2/src/crypto/csp_sha1.o ./libcsp-1.2/src/crypto/csp_xtea.o ./libcsp-1.2/src/arch/freertos/csp_malloc.o ./libcsp-1.2/src/arch/freertos/csp_queue.o ./libcsp-1.2/src/arch/freertos/csp_semaphore.o ./libcsp-1.2/src/arch/freertos/csp_system.o ./libcsp-1.2/src/arch/freertos/csp_thread.o ./libcsp-1.2/src/arch/freertos/csp_time.o ./libcsp-1.2/src/csp_buffer.o ./libcsp-1.2/src/csp_conn.o ./libcsp-1.2/src/csp_crc32.o ./libcsp-1.2/src/csp_debug.o ./libcsp-1.2/src/csp_endian.o ./libcsp-1.2/src/csp_io.o ./libcsp-1.2/src/csp_port.o ./libcsp-1.2/src/csp_route.o ./libcsp-1.2/src/csp_service_handler.o ./libcsp-1.2/src/csp_services.o ./STM32F4xx_StdPeriph_Driver/src/misc.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_adc.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_can.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_crc.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_cryp.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_cryp_aes.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_cryp_des.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_cryp_tdes.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dac.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dbgmcu.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dcmi.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dma.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_exti.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_fsmc.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_gpio.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_hash.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_hash_md5.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_hash_sha1.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_i2c.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_iwdg.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_pwr.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rng.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rtc.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_sdio.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_spi.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_syscfg.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_tim.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_usart.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_wwdg.o ./FreeRTOSV8.1.2/FreeRTOS/Source/croutine.o ./FreeRTOSV8.1.2/FreeRTOS/Source/event_groups.o ./FreeRTOSV8.1.2/FreeRTOS/Source/heap_2.o ./FreeRTOSV8.1.2/FreeRTOS/Source/list.o ./FreeRTOSV8.1.2/FreeRTOS/Source/port.o ./FreeRTOSV8.1.2/FreeRTOS/Source/queue.o ./FreeRTOSV8.1.2/FreeRTOS/Source/tasks.o ./FreeRTOSV8.1.2/FreeRTOS/Source/timers.o
c:/program files (x86)/gnu tools arm embedded/4.8 2014q2/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/bin/ld.exe: BFD (GNU Tools for ARM Embedded Processors) 2.23.2.20140529 assertion fail /home/build/work/GCC-4-8-build/src/binutils/bfd/elf32-arm.c:12394
c:/program files (x86)/gnu tools arm embedded/4.8 2014q2/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/bin/ld.exe: warning: cannot find entry symbol cs=nosys.specs; defaulting to 08000188
c:/program files (x86)/gnu tools arm embedded/4.8 2014q2/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m/softfp\libg.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'
c:/program files (x86)/gnu tools arm embedded/4.8 2014q2/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m/softfp\libg.a(lib_a-writer.o): In function `_write_r':
writer.c:(.text._write_r+0x10): undefined reference to `_write'
c:/program files (x86)/gnu tools arm embedded/4.8 2014q2/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m/softfp\libg.a(lib_a-closer.o): In function `_close_r':
closer.c:(.text._close_r+0xc): undefined reference to `_close'
c:/program files (x86)/gnu tools arm embedded/4.8 2014q2/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m/softfp\libg.a(lib_a-fstatr.o): In function `_fstat_r':
fstatr.c:(.text._fstat_r+0xe): undefined reference to `_fstat'
c:/program files (x86)/gnu tools arm embedded/4.8 2014q2/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m/softfp\libg.a(lib_a-isattyr.o): In function `_isatty_r':
isattyr.c:(.text._isatty_r+0xc): undefined reference to `_isatty'
c:/program files (x86)/gnu tools arm embedded/4.8 2014q2/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m/softfp\libg.a(lib_a-lseekr.o): In function `_lseek_r':
lseekr.c:(.text._lseek_r+0x10): undefined reference to `_lseek'
c:/program files (x86)/gnu tools arm embedded/4.8 2014q2/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m/softfp\libg.a(lib_a-readr.o): In function `_read_r':
readr.c:(.text._read_r+0x10): undefined reference to `_read'
collect2.exe: error: ld returned 1 exit status
make: *** [CSP_FreeRTOS.elf] Error 1
from libcsp.
with commented csp_init
10:18:40 **** Incremental Build of configuration Debug for project CSP_FreeRTOS ****
make all
'Building file: ../src/app.c'
'Invoking: Cross ARM C Compiler'
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -g3 -DUSE_STDPERIPH_DRIVER -DSTM32F4XX -D__FPU_USED -I"D:\mikrovaldikliai\STM32F4\programos\STM32F4-Discovery_FW_V1.1.0\Libraries\CMSIS\Include" -I"C:\Users\Raima\workspace\CSP_FreeRTOS\libcsp-1.2\include" -I"D:\mikrovaldikliai\STM32F4\programos\STM32F4-Discovery_FW_V1.1.0\Libraries\CMSIS\ST\STM32F4xx\Include" -I"C:\Users\Raima\workspace\CSP_FreeRTOS\STM32F4xx_StdPeriph_Driver\inc" -I"C:\Users\Raima\workspace\CSP_FreeRTOS\inc" -I"C:\Users\Raima\workspace\CSP_FreeRTOS\FreeRTOSV8.1.2\FreeRTOS\Source\include" -I"C:\Users\Raima\workspace\CSP_FreeRTOS\libcsp-1.2\src" -std=gnu11 -MMD -MP -MF"src/app.d" -MT"src/app.o" -c -o "src/app.o" "../src/app.c"
'Finished building: ../src/app.c'
' '
'Building target: CSP_FreeRTOS.elf'
'Invoking: Cross ARM C Linker'
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -g3 -T "C:\Users\Raima\workspace\CSP_FreeRTOS\ldscripts\stm32_flash.ld" -Xlinker --gc-sections -L"C:\Users\Raima\workspace\CSP_FreeRTOS\ldscripts" -Wl,-Map,"CSP_FreeRTOS.map" -o "CSP_FreeRTOS.elf" ./src/app.o ./src/startup_stm32f4xx.o ./src/stm32f4_discovery.o ./src/system_stm32f4xx.o ./src/usart_radio.o ./libcsp-1.2/src/transport/csp_rdp.o ./libcsp-1.2/src/transport/csp_udp.o ./libcsp-1.2/src/interfaces/csp_if_lo.o ./libcsp-1.2/src/crypto/csp_hmac.o ./libcsp-1.2/src/crypto/csp_sha1.o ./libcsp-1.2/src/crypto/csp_xtea.o ./libcsp-1.2/src/arch/freertos/csp_malloc.o ./libcsp-1.2/src/arch/freertos/csp_queue.o ./libcsp-1.2/src/arch/freertos/csp_semaphore.o ./libcsp-1.2/src/arch/freertos/csp_system.o ./libcsp-1.2/src/arch/freertos/csp_thread.o ./libcsp-1.2/src/arch/freertos/csp_time.o ./libcsp-1.2/src/csp_buffer.o ./libcsp-1.2/src/csp_conn.o ./libcsp-1.2/src/csp_crc32.o ./libcsp-1.2/src/csp_debug.o ./libcsp-1.2/src/csp_endian.o ./libcsp-1.2/src/csp_io.o ./libcsp-1.2/src/csp_port.o ./libcsp-1.2/src/csp_route.o ./libcsp-1.2/src/csp_service_handler.o ./libcsp-1.2/src/csp_services.o ./STM32F4xx_StdPeriph_Driver/src/misc.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_adc.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_can.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_crc.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_cryp.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_cryp_aes.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_cryp_des.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_cryp_tdes.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dac.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dbgmcu.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dcmi.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dma.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_exti.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_fsmc.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_gpio.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_hash.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_hash_md5.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_hash_sha1.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_i2c.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_iwdg.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_pwr.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rng.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rtc.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_sdio.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_spi.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_syscfg.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_tim.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_usart.o ./STM32F4xx_StdPeriph_Driver/src/stm32f4xx_wwdg.o ./FreeRTOSV8.1.2/FreeRTOS/Source/croutine.o ./FreeRTOSV8.1.2/FreeRTOS/Source/event_groups.o ./FreeRTOSV8.1.2/FreeRTOS/Source/heap_2.o ./FreeRTOSV8.1.2/FreeRTOS/Source/list.o ./FreeRTOSV8.1.2/FreeRTOS/Source/port.o ./FreeRTOSV8.1.2/FreeRTOS/Source/queue.o ./FreeRTOSV8.1.2/FreeRTOS/Source/tasks.o ./FreeRTOSV8.1.2/FreeRTOS/Source/timers.o
'Finished building target: CSP_FreeRTOS.elf'
' '
'Invoking: Cross ARM GNU Create Flash Image'
arm-none-eabi-objcopy -O ihex "CSP_FreeRTOS.elf" "CSP_FreeRTOS.hex"
'Finished building: CSP_FreeRTOS.hex'
' '
'Invoking: Cross ARM GNU Print Size'
arm-none-eabi-size --format=berkeley "CSP_FreeRTOS.elf"
text data bss dec hex filename
12868 1124 9660 23652 5c64 CSP_FreeRTOS.elf
'Finished building: CSP_FreeRTOS.siz'
from libcsp.
Hello,
It is possible to get help ?
from libcsp.
Your problem is not in libcsp.
You miss the newlib syscalls.c file providing functions like _sbrk, _read, _write, _exit etc. These must be provided to your newlib system. Please google "newlib syscalls" and see what you get. At the very least you must create a dummy syscalls.c file.
from libcsp.
I have found issue. It was with csp_autoconfig.h. Where we have csp_conn_max
and csp_conn_length
. They have values 10 and 100. If I write 1 and 1. Bys using example simple.c with debug mode I got such messages
Debug enabed
Level 3: value 1
Level 4: value 1
Conn table
[00 0x20000944] S:0, 0 -> 0, 0 -> 0, sock: 0x0
Route table
Node Interface Address
1 LOOP 1
* LOOP 255
Interfaces
LOOP tx: 00000 rx: 00000 txe: 00000 rxe: 00000
drop: 00000 autherr: 00000 frame: 00000
txb: 0 (0.0B) rxb: 0 (0.0B)
Starting Server task
Starting Client task
So the Question is
How to correctly configure CSP and how Freertosconfig.h influence csp_conn_max
and csp_conn_length
parameters ?
Maybe are more parameters in csp_autoconfig.h which must be corrected ?
from libcsp.
conn max and conn length is should not be set to 1, unless you really want to limit your system to only one connection.
I cannot see how changing those defines has anything to do with your original issue?
To answer you question directly:
There is no correct configuraiton of CSP autoconfig, you should set the values to what makes sense for your mission. The FreeRTOSconfig.h file does not have anything to do with CSP compile time parameters.
from libcsp.
I have solved a lot of mistakes and now I have such output
Initialising CSP
Debug enabed
Level 3: value 1
Level 4: value 1
Conn table
[00 0x20000944] S:0, 0 -> 0, 0 -> 0, sock: 0x0
[01 0x20000964] S:0, 0 -> 0, 0 -> 0, sock: 0x0
[02 0x20000984] S:0, 0 -> 0, 0 -> 0, sock: 0x0
[03 0x200009a4] S:0, 0 -> 0, 0 -> 0, sock: 0x0
[04 0x200009c4] S:0, 0 -> 0, 0 -> 0, sock: 0x0
[05 0x200009e4] S:0, 0 -> 0, 0 -> 0, sock: 0x0
[06 0x20000a04] S:0, 0 -> 0, 0 -> 0, sock: 0x0
[07 0x20000a24] S:0, 0 -> 0, 0 -> 0, sock: 0x0
[08 0x20000a44] S:0, 0 -> 0, 0 -> 0, sock: 0x0
[09 0x20000a64] S:0, 0 -> 0, 0 -> 0, sock: 0x0
Route table
Node Interface Address
1 LOOP 1
* LOOP 255
Interfaces
LOOP tx: 00000 rx: 00000 txe: 00000 rxe: 00000
drop: 00000 autherr: 00000 frame: 00000
txb: 0 (0.0B) rxb: 0 (0.0B)
Starting Server task
Starting Client task
I think where must execution of the tasks but I didn't get them
csp_autoconf.h is typical
csp_buffer_init(5, 100);
csp_route_start_task(50, 1);
if I write to big buffer size I got error
[1;31m[01] csp_route.c:392 Failed to start router task
int main() {
HwInit();
/* Init buffer system with 10 packets of maximum 300 bytes each */
printf("Initialising CSP\r\n");
csp_buffer_init(5, 100);
/* Init CSP with address MY_ADDRESS */
csp_init(MY_ADDRESS);
// Start router task with 500 word stack, OS task priority 1
csp_route_start_task(50, 1);
// Enable debug output from CSP
if (DEBUG == 1) {
printf("Debug enabed\r\n");
csp_debug_toggle_level(3);
csp_debug_toggle_level(4);
printf("Conn table\r\n");
csp_conn_print_table();
printf("Route table\r\n");
csp_route_print_table();
printf("Interfaces\r\n");
csp_route_print_interfaces();
}
// Server
printf("Starting Server task\r\n");
csp_thread_handle_t handle_server;
csp_thread_create(task_server, (signed char *) "SERVER", 1000, NULL, 0, &handle_server);
// Client
printf("Starting Client task\r\n");
csp_thread_handle_t handle_client;
csp_thread_create(task_client, (signed char *) "SERVER", 1000, NULL, 0, &handle_client);
while(1) {
csp_sleep_ms(100000);
}
return 0;
}
from libcsp.
Wait a minute, is that you main file? As i understood, you were running FreeRTOS, right? - You must start the scheduler for the OS to run. Calling sleep in the main thread, will not start the other tasks. I'm closing this issue now, because it's not related to libcsp.
from libcsp.
@raimapo hi do you mind sharing how you managed to get rid of the undefined reference problem?
I got the same problem here when any of these CSP functions is used: csp_init, csp_i2c_init, csp_route_set, csp_route_start_task, csp_transaction.
Here is how the error looks like:
/usr/local/gcc-arm-none-eabi-4_8-2014q3/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7-m/libg.a(lib_a-sbrkr.o): In function _sbrk_r': sbrkr.c:(.text._sbrk_r+0xc): undefined reference to
_sbrk'
/usr/local/gcc-arm-none-eabi-4_8-2014q3/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7-m/libg.a(lib_a-closer.o): In function _close_r': closer.c:(.text._close_r+0xc): undefined reference to
_close'
/usr/local/gcc-arm-none-eabi-4_8-2014q3/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7-m/libg.a(lib_a-fstatr.o): In function _fstat_r': fstatr.c:(.text._fstat_r+0xe): undefined reference to
_fstat'
/usr/local/gcc-arm-none-eabi-4_8-2014q3/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7-m/libg.a(lib_a-isattyr.o): In function _isatty_r': isattyr.c:(.text._isatty_r+0xc): undefined reference to
_isatty'
/usr/local/gcc-arm-none-eabi-4_8-2014q3/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7-m/libg.a(lib_a-lseekr.o): In function _lseek_r': lseekr.c:(.text._lseek_r+0x10): undefined reference to
_lseek'
collect2: error: ld returned 1 exit status
from libcsp.
Hello ajienikicio,
In ubuntu I have used syscalls.c with littlebit modification for my project from
https://github.com/jserv/stm32f429-lcd-demo/blob/master/base/syscalls.c
Current version of libscp very well works in keil uvision 5.13 in windows and I didn't need additionally this file anymore
from libcsp.
Hello raimapo,
Thanks for the reply! This was very helpful and now I can compile my project. Btw, I'm using an Atmel Cortex M-3 MCU and in addition to the syscalls.c, the steps in this link was required http://asf.atmel.com/bugzilla/show_bug.cgi?id=3474 to get the job done.
I'm currently having a problem in csp_buffer_init though. The code hangs at csp_malloc(poolsize). I wonder if this is related to the FreeRTOS v8.1.2 that I'm using. May I know which version of FreeRTOS you are using?
from libcsp.
Hello,
- create " int val"
- "val = csp_buffer_init ...."
- send "val" to terminal through UART
- if you get -1 - not enough memory, if you get 0 it's ok
- if -1 change amount of memory in freertos or etc.
With this helped me one of the CSP creator then he visiting my country :D
Sincerely Yours,
Raimondas
From: ajienikicio [[email protected]]
Sent: Monday, March 02, 2015 12:15 PM
To: GomSpace/libcsp
Cc: Raimondas Pomarnacki
Subject: Re: [libcsp] unknown error csp_init (#39)
Hello raimapo,
Thanks for the reply! This was very helpful and now I can compile my project. Btw, I'm using an Atmel Cortex M-3 MCU and in addition to the syscalls.c, the steps in this link was required http://asf.atmel.com/bugzilla/show_bug.cgi?id=3474 to get the job done.
I'm currently having a problem in csp_buffer_init though. The code hangs at csp_malloc(poolsize). I wonder if this is related to the FreeRTOS v8.1.2 that I'm using. May I know which version of FreeRTOS you are using?
—
Reply to this email directly or view it on GitHubhttps://github.com/GomSpace/libcsp/issues/39#issuecomment-76687063.
from libcsp.
Hello Raimondas,
The problem is the code hangs at this line (inside csp_buffer.c):
csp_buffer_pool = csp_malloc(poolsize);
It hangs even before csp_buffer_init can return anything. I've tried to change the FreeRTOSConfig.h according to what you have at the top of this page but nothing happened.
This is how I use the CSP functions in my main code. It is basically an LED blinking code.
int main( void )
{
/* Prepare the hardware to run this demo. */
prvSetupHardware();
csp_buffer_init(5, 100);
csp_init(ADCS_EP_CSP_ADDRESS); // Init internal bufers, and remember the node id.
csp_i2c_init(ADCS_EP_CSP_ADDRESS, 0, 400); // Layer 2 init
csp_route_set(1, &csp_if_i2c, CSP_NODE_MAC);
csp_route_start_task(500, 1);
uint8_t abc[3] = {100, 200, 255};
int csp_status = csp_transaction(CSP_PRIO_HIGH, 1, 30, 5000, abc, sizeof(abc), NULL, 0);
main_blinky();
return 0;
}
from libcsp.
You cannot run freebsd in the main function. You need to start the scheduler first and run the code from a task.
Den 03/03/2015 kl. 08.14 skrev ajienikicio <[email protected]mailto:[email protected]>:
Hello Raimondas,
The problem is the code hangs at this line (inside csp_buffer.c):
csp_buffer_pool = csp_malloc(poolsize);
It hangs even before csp_buffer_init can return anything. I've tried to change the FreeRTOSConfig.h according to what you have at the top of this page but nothing happened.
This is how I use the CSP functions in my main code. It is basically an LED blinking code.
int main( void )
{
/* Prepare the hardware to run this demo. */
prvSetupHardware();
csp_buffer_init(5, 100);
csp_init(ADCS_EP_CSP_ADDRESS); // Init internal bufers, and remember the node id.
csp_i2c_init(ADCS_EP_CSP_ADDRESS, 0, 400); // Layer 2 init
csp_route_set(1, &csp_if_i2c, CSP_NODE_MAC);
csp_route_start_task(500, 1);
uint8_t abc[3] = {100, 200, 255};
int csp_status = csp_transaction(CSP_PRIO_HIGH, 1, 30, 5000, abc, sizeof(abc), NULL, 0);
main_blinky();
return 0;
}
Reply to this email directly or view it on GitHubhttps://github.com/GomSpace/libcsp/issues/39#issuecomment-76903754.
from libcsp.
Hello ajienikicio,
Please check example simple.c and go line by line. Also in freertos you must use scheduler “vTaskStartScheduler();”, which is not included in example. I must to note what in CSP are used little bit different way to create tasks.
Sincerely Yours,
Raimondas
From: ajienikicio [mailto:[email protected]]
Sent: Tuesday, March 3, 2015 10:14 AM
To: GomSpace/libcsp
Cc: Raimondas Pomarnacki
Subject: Re: [libcsp] unknown error csp_init (#39)
Hello Raimondas,
The problem is the code hangs at this line (inside csp_buffer.c):
csp_buffer_pool = csp_malloc(poolsize);
It hangs even before csp_buffer_init can return anything. I've tried to change the FreeRTOSConfig.h according to what you have at the top of this page but nothing happened.
This is how I use the CSP functions in my main code. It is basically an LED blinking code.
int main( void )
{
/* Prepare the hardware to run this demo. */
prvSetupHardware();
csp_buffer_init(5, 100);
csp_init(ADCS_EP_CSP_ADDRESS); // Init internal bufers, and remember the node id.
csp_i2c_init(ADCS_EP_CSP_ADDRESS, 0, 400); // Layer 2 init
csp_route_set(1, &csp_if_i2c, CSP_NODE_MAC);
csp_route_start_task(500, 1);
uint8_t abc[3] = {100, 200, 255};
int csp_status = csp_transaction(CSP_PRIO_HIGH, 1, 30, 5000, abc, sizeof(abc), NULL, 0);
main_blinky();
return 0;
}
—
Reply to this email directly or view it on GitHubhttps://github.com/GomSpace/libcsp/issues/39#issuecomment-76903754.
from libcsp.
Hello,
Sorry for being unclear, the scheduler is already included in the main_blinky() function.
I see in nanomind's main.c and in page 11 of this document http://gomspace.com/documents/GS-CSP-1.1.pdf that the CSP initialization is done in the main() function before starting the scheduler, that's why I'm placing the CSP functions there. I don't think that my code can even reach the scheduler hence it hangs. I've checked that the code stops at the csp_buffer_init. Specifically at this line: csp_buffer_pool = csp_malloc(poolsize);
void main_blinky( void )
{
/* Create the queue. */
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) );
if( xQueue != NULL )
{
/* Start the two tasks as described in the comments at the top of this
file. */
xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_RECEIVE_PARAMETER, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, ( void * ) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY, NULL );
/* Start the tasks and timer running. */
vTaskStartScheduler();
}
for( ;; );
}
from libcsp.
Hello,
Maybe this code will help you a littlebit
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32f4xx_hal.h"
#include "stm32f4_discovery.h"
#include "debug.h"
#include "gpio.h"
#include "uart.h"
/** @addtogroup Template
* @{
*/
static void SystemClock_Config(void);
static void Error_Handler(void);
#include
/* Using un-exported header file.
* This is allowed since we are still in libcsp */
#include
/** Example defines */
#define MY_ADDRESS 1 // Address of local CSP node
#define MY_PORT 10 // Port to send test traffic to
CSP_DEFINE_TASK(task1);
CSP_DEFINE_TASK(task2);
/* Private functions ---------------------------------------------------------*/
int main(void)
{
int val;
HAL_Init();
BSP_LED_Init(LED4_GREEN);
BSP_LED_Init(LED3_ORANGE);
BSP_LED_Init(LED5_RED);
BSP_LED_Init(LED6_BLUE);
SystemClock_Config();
DEBUG_Init();
// Init buffer system with 10 packets of maximum 300 bytes each
DEBUG("Initialising CSP\r\n");
val=csp_buffer_init(5, 300);
DEBUG("csp_buffer_init=%d\r\n",val);
// Init CSP with address MY_ADDRESS
val=csp_init(MY_ADDRESS);
DEBUG("csp_init=%d\r\n",val);
// Start router task with 500 word stack, OS task priority 1
val=csp_route_start_task(500, 1);
DEBUG("csp_route_start_task=%d\r\n",val);
/*
//Enable debug output from CSP
if (CSP_DEBUG == 0) {
DEBUG("Debug enabed\r\n");
csp_debug_toggle_level(3);
csp_debug_toggle_level(4);
DEBUG("Conn table\r\n");
csp_conn_print_table();
DEBUG("Route table\r\n");
csp_route_print_table();
DEBUG("Interfaces\r\n");
csp_route_print_interfaces();
}
*/
/* TASK1 */
DEBUG("Starting Server task\r\n");
csp_thread_handle_t handle_task1;
val=csp_thread_create(task1, (signed char *) "TASK1", 200, NULL, 1, &handle_task1);
DEBUG("csp_thread_create task1 =%d\r\n",val);
/* TASK2 */
DEBUG("Starting Client task\r\n");
csp_thread_handle_t handle_task2;
val=csp_thread_create(task2, (signed char *) "TASK2", 200, NULL, 1, &handle_task2);
DEBUG("csp_thread_create task2 =%d\r\n",val);
vTaskStartScheduler();
while (1)
{
__NOP();
}
}
CSP_DEFINE_TASK(task1) {
while(1){
BSP_LED_Toggle(LED5_RED);
vTaskDelay(1000);
}
return CSP_TASK_RETURN;
}
CSP_DEFINE_TASK(task2) {
while(1){
BSP_LED_Toggle(LED6_BLUE);
vTaskDelay(500);
}
return CSP_TASK_RETURN;
}
/*
* The system Clock is configured as follow:
* System Clock source = PLL (HSE)
* SYSCLK(Hz) = 168000000
* HCLK(Hz) = 168000000
* AHB Prescaler = 1
* APB1 Prescaler = 4
*
* HSE Frequency(Hz) = 8000000
* PLL_M = 8
* PLL_N = 336
* PLL_P = 2
* PLL_Q = 7
* VDD(V) = 3.3
* Main regulator output voltage = Scale1 mode
* Flash Latency(WS) = 5
*/
static void SystemClock_Config(void)
{
RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_OscInitTypeDef RCC_OscInitStruct;
// Enable Power Control clock
__PWR_CLK_ENABLE();
/*
* The voltage scaling allows optimizing the power consumption when the device is
* clocked below the maximum system frequency, to update the voltage scaling value
* regarding system frequency refer to product datasheet.
*/
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
// Enable HSE Oscillator and activate PLL with HSE as source
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = 8;
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 7;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
// Initialization Error
Error_Handler();
}
// Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers
RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK)
{
// Initialization Error
Error_Handler();
}
return;
}
static void Error_Handler(void)
{
// User may add here some code to deal with this error
//BSP_LED_On(LED3);
while (1)
{
__NOP();
}
}
#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t* file, uint32_t line)
{
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* Infinite loop */
while (1)
{
__NOP();
}
}
#endif
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
from libcsp.
Related Issues (20)
- API for Per interface CSP Address HOT 4
- Unused items in csp_service_handler.c: alloca, CSP_RPS_MTU
- Replace non-standard malloc.h with stdlib.h
- Tag v2.0 HOT 2
- Unused macros in csp_id.c HOT 1
- "./waf install" does not install any files or directories HOT 5
- Multi-Interface, Single-Device Configuration (CSP 1.x) HOT 9
- Have a nice logo HOT 10
- Unclear/outdated docs how to use CAN interface HOT 6
- Fix or remove outdated wiki HOT 1
- Add install target in CMake
- No example how to use UDP HOT 3
- Move csp_macro.h to src/
- buildall.py fails in container HOT 5
- socketcan write() errors in csp_can_tx_frame(): ENOBUFS vs EAGAIN HOT 2
- kiss: Add node_id parameter
- Remove dynamic memory allocations like malloc and calloc
- Can't use ZMQ interface on csp_server_client with cmake HOT 1
- What is the correct way to use kiss uart on freertos? HOT 1
- Add disclaimer about latest version
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libcsp.