I try to operate the mailbox example in embOS but to send the message not from the main.c but from other file.
I write the create in the main.c
#define MAIN
.
.
.
OS_MAILBOX_Create(&MyMailbox, MAX_MSG_SIZE, MAX_MSG_NUM, &MyMailboxBuffer);
where all the deafine and announce sit in main.h where I use extern for all except main that call them like this:
#ifndef MAIN // only main use those variables and function as original
#define EXTERN extern
#else
#define EXTERN
#endif
#include "RTOS.h"
/* MailBox defines */
#define MAX_MSG_SIZE (9) // Max. number of bytes per message
#define MAX_MSG_NUM (2) // Max. number of messages per Mailbox
EXTERN OS_MAILBOX MyMailbox;
EXTERN char MyMailboxBuffer[MAX_MSG_SIZE * MAX_MSG_NUM];
on file call SPI.c
I write this
#include "main.h"
.
.
.
OS_MAILBOX_Put(&MyMailbox, "\nHello\0");
When the program get to this line it jump to error function
void OS_Error(OS_STATUS ErrCode)
But if I run OS_MAILBOX_Put... from the main.c it save the message to the buffer.
What do I miss?
Bar.
I write the create in the main.c
#define MAIN
.
.
.
OS_MAILBOX_Create(&MyMailbox, MAX_MSG_SIZE, MAX_MSG_NUM, &MyMailboxBuffer);
where all the deafine and announce sit in main.h where I use extern for all except main that call them like this:
#ifndef MAIN // only main use those variables and function as original
#define EXTERN extern
#else
#define EXTERN
#endif
#include "RTOS.h"
/* MailBox defines */
#define MAX_MSG_SIZE (9) // Max. number of bytes per message
#define MAX_MSG_NUM (2) // Max. number of messages per Mailbox
EXTERN OS_MAILBOX MyMailbox;
EXTERN char MyMailboxBuffer[MAX_MSG_SIZE * MAX_MSG_NUM];
on file call SPI.c
I write this
#include "main.h"
.
.
.
OS_MAILBOX_Put(&MyMailbox, "\nHello\0");
When the program get to this line it jump to error function
void OS_Error(OS_STATUS ErrCode)
But if I run OS_MAILBOX_Put... from the main.c it save the message to the buffer.
What do I miss?
Bar.