AnsweredAssumed Answered

ASM error when using an array containing struct elements

Question asked by SvenS on Feb 7, 2016
Latest reply on Feb 7, 2016 by SvenS

I have an array, that should contain structures for the input and output pins as follows:
typedef struct inputStruct
    uint16_t pin;
    GPIO_TypeDef *port;
struct inputStruct inputPins[20];
void initPins(void)
    uint8_t counter = 0;
    inputPins[0].pin = GPIO_Pin_0;
    inputPins[0].port = GPIOA;
    inputPins[1].pin = GPIO_Pin_1;
    inputPins[1].port = GPIOA;
. //some more pin definitions here
    inputPins[20].pin = GPIO_Pin_4;
    inputPins[20].port = GPIOB;
    for(counter = 0; counter < 20; counter++)
void initInput(input_t channel)
    GPIO_InitTypeDef GPIO_InitStructure;
    uint32_t clockSystem;
    if(channel.port == GPIOA)
        clockSystem = RCC_AHBPeriph_GPIOA;
    else if(channel.port == GPIOB)
        clockSystem = RCC_AHBPeriph_GPIOB;
    else if(channel.port == GPIOC)
        clockSystem = RCC_AHBPeriph_GPIOC;
    RCC_AHBPeriphClockCmd(clockSystem, ENABLE);
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
    GPIO_InitStructure.GPIO_Pin =;
    GPIO_InitStructure.GPIO_PuPd  = GPIO_PuPd_UP;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz;
    GPIO_Init(channel.port, &GPIO_InitStructure);

When compiling, I get the following error messages:

Info: Internal Builder is used for build
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -std=c11 -DNUCLEO_L152RE -DSTM32L1 -DSTM32L152RETx -DSTM32 -DDEBUG -DUSE_STDPERIPH_DRIVER -DSTM32L1XX_XL -I/home/sven/workspace/micaFirmware/inc -I/home/sven/workspace/micaFirmware/CMSIS/device -I/home/sven/workspace/micaFirmware/CMSIS/core -I/home/sven/workspace/micaFirmware/StdPeriph_Driver/inc -I/home/sven/workspace/micaFirmware/Utilities -O0 -g3 -Wall -fmessage-length=0 -ffunction-sections -c -o src/syscalls.o ../src/syscalls.c
../src/syscalls.c:63:27: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'asm'
 register char * stack_ptr asm("sp");
../src/syscalls.c: In function '_sbrk':
../src/syscalls.c:116:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'asm'
  extern char end asm("end");
../src/syscalls.c:116:18: warning: implicit declaration of function 'asm' [-Wimplicit-function-declaration]
../src/syscalls.c:121:15: error: 'end' undeclared (first use in this function)
   heap_end = &end;
../src/syscalls.c:121:15: note: each undeclared identifier is reported only once for each function it appears in
../src/syscalls.c:124:24: error: 'stack_ptr' undeclared (first use in this function)
  if (heap_end + incr > stack_ptr)

Is there just a library missing or what's going on here?

I use System Workbench for STM32