Atmel Studio 6 & BitCloud macro definition problem SAM3S

Go To Last Post
17 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello people, I have a board from dresden electronics (deRFusb23e00) that is SAM3S4 based. Im using Bitcloud and Atmel Studio 6. I previously compiled some examples successfully to it but lately I tried to use BitCloud Profile Suite. The problem is that compiler throws an error saying that there are some undefined macros in uartManager.c:

Quote:
USART_CHANEL' undeclared(first use in this function)
USART_RX_BUFFER_LENGHT' undeclared(first use in this fuction)

The exactly same example is running fine on my RCB128RFA1!!!
In the code I certified myself that macros are defined. I also tried to change the macros for real values, but it keeps giving me the same errors. I checked almost everything including Makefile and everything seems to be on place but I know that Im missing something.
I suspect that is a compilation problem.

Anyone with this similar macro definition problem?

Last Edited: Fri. Oct 16, 2015 - 02:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

USART_CHANEL' undeclared(first use in this function)
USART_RX_BUFFER_LENGHT' undeclared(first use in this fuction)

Well for one thing that spelling looks suspicious. Chanel is a brand of perfume named after the designer Coco Chanel, Channel is the word in English meaning one path.

Similarly the word in the second is almost certainly "Length" not "Lenght".

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry for my bad writing!!!
I wrote the errors, not copied from AS6.
It should be like this:

Quote:
'USART_CHANNEL'undeclared(first use in this function)
USART_RX_BUFFER_LENGTH' undeclared(first use in this fuction)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

I wrote the errors, not copied from AS6.

Why waste everyone's time doing that?

If the errors are now as you show then grep the.h files for where those values are defined and ensure you are #including the appropriate .h file.

Having said that the very names of these sound like two user configuration parameters. Surely it's giving you the user a chance to say which UART you want to use and how big a buffer you'd like it to have. So I guess the reason you don't have these resolved is that it's left to you to #define them (maybe in your own config.h or something?)

If you have a project where this works I'd grep that for these macro names and I'll bet you find some code you wrote to define them previously.

BTW I'll move this to the Wireless forum where the actual Bitcloud developers will see it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
So I guess the reason you don't have these resolved is that it's left to you to #define them (maybe in your own config.h or something?)

The macros that preceed those (USART_CHANNEL and USART_RX_BUFFER_LENGTH) are defined in configuration.h.
As I said, even if I change the macros for real values it keeps giving me the same errors!
I know the compiler is not seeing them...

In my Makefile:

Quote:
DEFINES = \
-DBOARD_DERFUSB23E06 \
-DAT91SAM3S4C \
-DHAL_64MHz \
-DLIB_TYPE_ZCL \
-DSTACK_TYPE_ALL \
-DSTDLINK_SECURITY_MODE \
-DAT86RF231

This is part of my configuration.h:

-----------------------------------------------
//BOARD_DERFUSB23E06
//-----------------------------------------------
#ifdef BOARD_DERFUSB23E06
  // Defines primary serial interface type to be used by application.
  #define APP_INTERFACE APP_INTERFACE_VCP
  
  //-----------------------------------------------
  //APP_INTERFACE == APP_INTERFACE_UART
  //-----------------------------------------------
  #if (APP_INTERFACE == APP_INTERFACE_UART)
    // Defines UART interface name to be used by application.
    #define APP_UART_CHANNEL UART_CHANNEL_0
    //#define APP_UART_CHANNEL UART_CHANNEL_1
  #endif
  
  //-----------------------------------------------
  //APP_INTERFACE == APP_INTERFACE_VCP
  //-----------------------------------------------
  #if (APP_INTERFACE == APP_INTERFACE_VCP)
    // Defines USART interface name to be used by application.
    #define APP_USART_CHANNEL USART_CHANNEL_VCP
  #endif
  
  //-----------------------------------------------
  //APP_INTERFACE == APP_INTERFACE_USART
  //-----------------------------------------------
  #if (APP_INTERFACE == APP_INTERFACE_USART)
    // Defines USART interface name to be used by application.
    #define APP_USART_CHANNEL USART_CHANNEL_1
    //#define APP_USART_CHANNEL USART_CHANNEL_0
  #endif
  
  // Enable this option if target board suports controlling of TTL to RS232 converter
  // enable pin.
  #define BSP_ENABLE_RS232_CONTROL 1
  //#define BSP_ENABLE_RS232_CONTROL 0
#endif //

This is part of uartManager.h:

#ifndef _UARTMANAGER_H
#define _UARTMANAGER_H

/*************************************************************************
                   Includes section
**************************************************************************/
#include 

#if APP_INTERFACE == APP_INTERFACE_UART
  #include 
#endif // APP_INTERFACE_UART

#if APP_INTERFACE == APP_INTERFACE_VCP
  #include 
#endif // APP_INTERFACE_VCP

#if APP_INTERFACE == APP_INTERFACE_USBFIFO
  #include 
#endif // APP_INTERFACE_USBFIFO

/*************************************************************************
                   Definitions section
**************************************************************************/
#if APP_INTERFACE == APP_INTERFACE_VCP
  #define OPEN_USART            VCP_OpenUsart
  #define CLOSE_USART           VCP_CloseUsart
  #define WRITE_USART           VCP_WriteUsart
  #define READ_USART            VCP_ReadUsart
  #define USART_CHANNEL         APP_USART_CHANNEL
  #define USART_RX_BUFFER_LENGTH 64
#endif // APP_INTERFACE_VCP

This is part of uartManager.c:

/*******************************************************************************
                             Includes section
*******************************************************************************/
#include 
#include 
#include 
#include 
#ifdef BSP_ENABLE_RS232_CONTROL
#include 
#endif /* BSP_ENABLE_RS232_CONTROL */

/*******************************************************************************
                             Local variables section
*******************************************************************************/
static uint8_t uartBuffer[APP_TMP_DATA_BUFFER_SIZE];
static uint8_t uartBufferActualLength = 0;

static HAL_UsartDescriptor_t appUsartDescriptor;      // UART descriptor (required by stack)
static bool uartTxBusyFlag = false;                   // UART transmission transaction status
static uint8_t uartTxBuffer[APP_UART_TX_BUFFER_SIZE]; // UART Tx buffer

/*******************************************************************************
                             Static functions section
*******************************************************************************/
static void uartWriteConf(void);

/*******************************************************************************
                             Glabal functions section
*******************************************************************************/
void uartInit(void);
void sendDataToUart(uint8_t *data, uint8_t length);

/*******************************************************************************
                             Implementation section
*******************************************************************************/
/*******************************************************************************
  Description: Init UART, register UART callbacks
  Parameters:  none
  Returns:     none
*******************************************************************************/
void uartInit(void)
{
  uartTxBusyFlag = false;

  appUsartDescriptor.tty             = USART_CHANNEL;
  appUsartDescriptor.mode            = USART_MODE_ASYNC;
  appUsartDescriptor.baudrate        = USART_BAUDRATE_38400;
  appUsartDescriptor.dataLength      = USART_DATA8;
  appUsartDescriptor.parity          = USART_PARITY_NONE;
  appUsartDescriptor.stopbits        = USART_STOPBIT_1;
  appUsartDescriptor.rxBuffer        = NULL;
  appUsartDescriptor.rxBufferLength  = USART_RX_BUFFER_LENGTH;
  appUsartDescriptor.txBuffer        = NULL; // use callback mode
  appUsartDescriptor.txBufferLength  = 0;
  appUsartDescriptor.rxCallback      = NULL;
  appUsartDescriptor.txCallback      = uartWriteConf;
  appUsartDescriptor.flowControl     = USART_FLOW_CONTROL_NONE;

#if BSP_ENABLE_RS232_CONTROL == 1
  BSP_EnableRs232();
#endif
  OPEN_USART(&appUsartDescriptor);
}

I can conclude that:

APP_INTERFACE = APP_INTERFACE_VCP
APP_USART_CHANNEL = USART_CHANNEL_VCP
USART_CHANNEL = APP_USART_CHANNEL = USART_CHANNEL_VCP
USART_RX_BUFFER_LENGTH = 64

Tell me if Im doing something wrong.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Please don't create multiple posts with the same question.

BitCloud was not tested with AS6 and AS6 GCC for AVR has known issues, so it is entirely possible that ARM GCC has some issues as well.

BitCloud PS was tested on GCC version 4.6.2 from Yagarto, I believe.

Also, I can't find BitCloud package that includes BOARD_DERFUSB23E06 support. Where you've got it from?

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I adapted the package that Dresden Electronics provided to my board deRFusb23E00 to BitCloud_SAM3S_EK_1_14_0. Its just some files specific for my board (HAL and BSP) and Makefile. Maybe its is a ARM GCC problem because I compiled exactly the same program to my RCB128RFA1 (BitCloud_PS_MEGARF_1_10) and it works fine.
Im having a lot of issues with AS6.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So it is not a package provided by Atmel. I think you should have mentioned it before.

I don't know what they might have done wrong while doing support for this board, sorry. May be you should ask DE.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello duduspot,

With Yagartho 4.6.2 the WSNDemo should compile just fine (by using just the Makefile, AS6 is not tested).

So for a quick check:

Then using BitCloud_SAM3S_EK_1_14_0 and BitCloud_SAM3S_EK_1_14_0_extension from dresden elektronik. Did the WSNDemo (without modifications) compile correctly?

You may try to execute make from the commandline in the WSNDemo folder (yagartho GCC 4.6.2 has to be in the PATH for this to work).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alexru,

DE gives packages in order to BitCloud can suppport their boards with just a little modifications. In this case I asked DE a package for Bitcloud Profile Suite 1.10 (for RCB and deRFusb23e00) but they didnt answer me yet (maybe thay are on vacations) but normally its just a little modiification on BSP, HAL and makefile. So I tried myself for RCB and at least it compiles correctly...but unfortunatelly deRFusb23e00 dont.

manuelp,

Using BitCloud_SAM3S_EK_1_14_0 extension and BitCloud_MEGARF_1_14_0 extension my boards work perfect.
I just dont have extensions yet from DE to Bitcloud Profile Suite.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, it is possible that there is some mistake in the modification. Can you compile original, not modified version?

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

First I had to create an AS6 project for SAM3S4C (looking for the IAR project) because there is no one in BitCloud. After created it I tried to compile but some "low level" errors show up:

Quote:
Error 1 undefined reference to `__exidx_start' /usr/local/avr32studio/hudson/workspace/arm-gnu-toolchain/.build/src/gcc-4.6.1/libgcc/../gcc/config/arm/unwind-arm.c 614 1 SE_test
Error 2 undefined reference to `__exidx_end' /usr/local/avr32studio/hudson/workspace/arm-gnu-toolchain/.build/src/gcc-4.6.1/libgcc/../gcc/config/arm/unwind-arm.c 614 1 SE_test
Error 3 undefined reference to `_exit' C:\BitCloud_PS_SAM3S_EK_1_10_0\Applications\Profiles\SEDevice\as6_projects\SE_test\abort.c 1 1 SE_test
Error 4 undefined reference to `_kill' C:\BitCloud_PS_SAM3S_EK_1_10_0\Applications\Profiles\SEDevice\as6_projects\SE_test\signalr.c 1 1 SE_test
Error 5 undefined reference to `_getpid' C:\BitCloud_PS_SAM3S_EK_1_10_0\Applications\Profiles\SEDevice\as6_projects\SE_test\signalr.c 1 1 SE_test

but I had not the previous USART errors, and this probably because the DE patch.
Anyway, I have to move to a reliable solution to compile code to my USB stick, although I will not reach my project deadline.
Im thinking to use IAR. Is it a good solution for now?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For when a new release of BitCloud Profile Suite with AS6 SAM3S support?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why not just trace when those macros disappear with DE patch?

I have no information about new release schedule.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For BitCloud Profile Suite on deRFusb23e00 you could try the Atmel *RF231USBRD based projects. They should work with the deRFusb23e00/deRFusb23e06 too, difference is mainly the USB vendor/device id so you have to install Atmels VCP driver .inf file from BitCloud/ThirdPartySoftware directory.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello again!
Im still trying to addapt things in my BitCloud Profile Suite in order to work with my board. Unfortunately my boards manufacturer dont give support for Profile Suite.
So, I have a question and maybe it sounds silly: do BitCloud SDK 1.14 share the same "core" as BitCloud Profile Suite 1.10? or they are too different?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In terms of source code PS is basically a regular SDK with ZigBee Cluster library added on top. But it is compiled with different settings and binary libraries are not interchangeable, but any BSP and HAL changes are applicable to both versions.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.