debugging mem exception

This commit is contained in:
Robin Müller 2022-05-29 16:06:19 +02:00
parent cc138c6886
commit eccf453415
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
7 changed files with 36 additions and 30 deletions

View File

@ -48,10 +48,10 @@ This demo can be run on a STM32H743ZI-Nucleo board with the FreeRTOS OSAL.
## General Information ## General Information
The board is flashed and debugged with OpenOCD and this README specifies on how The board is flashed and debugged with [OpenOCD](https://openocd.org/) and this README specifies on
to make this work with the Eclipse IDE. Other IDEs or the command line can be used as well as long how to make this work with the Eclipse IDE. Other IDEs or the command line can be used as well as
as long as OpenOCD integration is given. The example demo uses newlib nano (glibc). long as long as OpenOCD integration is given. The example demo uses newlib nano (glibc).
Some system calls were overriden so the C and C++ stdio functions work. IO is sent via the HUART3, Some system calls were overriden so the C and C++ `stdio` functions work. IO is sent via the HUART3,
so debug output can be read directly from the USB connection to the board. so debug output can be read directly from the USB connection to the board.
## Prerequisites ## Prerequisites

View File

@ -16,7 +16,7 @@ ReturnValue_t SpiTest::performOperation(uint8_t opCode) {
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
std::array<uint8_t, 3> recBuf; std::array<uint8_t, 3> recBuf{};
uint8_t *recPtr = recBuf.data(); uint8_t *recPtr = recBuf.data();
size_t readLen = 0; size_t readLen = 0;
return spiComIF.readReceivedMessage(&spiCookie, &recPtr, &readLen); return spiComIF.readReceivedMessage(&spiCookie, &recPtr, &readLen);

View File

@ -7,7 +7,7 @@
class SpiTest { class SpiTest {
public: public:
SpiTest(SpiComIF &spiComIF); explicit SpiTest(SpiComIF &spiComIF);
ReturnValue_t performOperation(uint8_t opCode = 0); ReturnValue_t performOperation(uint8_t opCode = 0);

View File

@ -17,15 +17,16 @@
#include "FreeRTOS.h" #include "FreeRTOS.h"
void assemlyDemo();
void InitMission::createTasks() { void InitMission::createTasks() {
TaskFactory *taskFactory = TaskFactory::instance(); TaskFactory *taskFactory = TaskFactory::instance();
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
#if OBSW_ADD_CORE_COMPONENTS == 1 #if OBSW_ADD_CORE_COMPONENTS == 1
/* TMTC Distribution */ /* TMTC Distribution */
PeriodicTaskIF *distributerTask = PeriodicTaskIF *distributerTask =
taskFactory->createPeriodicTask("DIST", 5, 1024 * 2, 0.2, nullptr); taskFactory->createPeriodicTask("DIST", 5, 1024 * 2, 0.2, nullptr);
ReturnValue_t result = result = distributerTask->addComponent(objects::CCSDS_DISTRIBUTOR);
distributerTask->addComponent(objects::CCSDS_DISTRIBUTOR);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
task::printInitError("CCSDS distributor", objects::CCSDS_DISTRIBUTOR); task::printInitError("CCSDS distributor", objects::CCSDS_DISTRIBUTOR);
} }
@ -38,6 +39,7 @@ void InitMission::createTasks() {
task::printInitError("TM funnel", objects::TM_FUNNEL); task::printInitError("TM funnel", objects::TM_FUNNEL);
} }
#if OBSW_ADD_LWIP_COMPONENTS == 1
/* UDP bridge */ /* UDP bridge */
PeriodicTaskIF *udpBridgeTask = TaskFactory::instance()->createPeriodicTask( PeriodicTaskIF *udpBridgeTask = TaskFactory::instance()->createPeriodicTask(
"UDP_UNIX_BRIDGE", 6, 1024 * 2, 0.2, nullptr); "UDP_UNIX_BRIDGE", 6, 1024 * 2, 0.2, nullptr);
@ -51,6 +53,7 @@ void InitMission::createTasks() {
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
task::printInitError("UDP polling task", objects::UDP_POLLING_TASK); task::printInitError("UDP polling task", objects::UDP_POLLING_TASK);
} }
#endif
PeriodicTaskIF *eventManagerTask = PeriodicTaskIF *eventManagerTask =
TaskFactory::instance()->createPeriodicTask("EVENT_MGMT", 4, 1024 * 2, TaskFactory::instance()->createPeriodicTask("EVENT_MGMT", 4, 1024 * 2,
@ -183,8 +186,10 @@ void InitMission::createTasks() {
#if OBSW_ADD_CORE_COMPONENTS == 1 #if OBSW_ADD_CORE_COMPONENTS == 1
distributerTask->startTask(); distributerTask->startTask();
eventManagerTask->startTask(); eventManagerTask->startTask();
#if OBSW_ADD_LWIP_COMPONENTS == 1
udpBridgeTask->startTask(); udpBridgeTask->startTask();
udpPollingTask->startTask(); udpPollingTask->startTask();
#endif
#endif /* OBSW_ADD_CORE_COMPONENTS == 1 */ #endif /* OBSW_ADD_CORE_COMPONENTS == 1 */
#if OBSW_ADD_PUS_STACK == 1 #if OBSW_ADD_PUS_STACK == 1
@ -221,8 +226,7 @@ void InitMission::createTasks() {
#endif #endif
#if OBSW_ADD_DEVICE_HANDLER_DEMO #if OBSW_ADD_DEVICE_HANDLER_DEMO
HasModesIF *assembly = auto *assembly = ObjectManager::instance()->get<HasModesIF>(objects::TEST_ASSEMBLY);
ObjectManager::instance()->get<HasModesIF>(objects::TEST_ASSEMBLY);
if (assembly == nullptr) { if (assembly == nullptr) {
return; return;
} }
@ -236,16 +240,20 @@ void InitMission::createTasks() {
#endif #endif
TaskFactory::delayTask(5000); TaskFactory::delayTask(5000);
CommandMessage modeMessage;
ModeMessage::setModeMessage(&modeMessage, ModeMessage::CMD_MODE_COMMAND,
DeviceHandlerIF::MODE_NORMAL,
TestAssembly::submodes::DUAL);
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "Commanding Test Assembly to Normal, Dual" << std::endl;
#else
sif::printInfo("Commanding Test Assembly to Normal, Dual \n");
#endif
MessageQueueSenderIF::sendMessage(assembly->getCommandQueue(), &modeMessage,
MessageQueueIF::NO_QUEUE);
#endif /* OBSW_ADD_DEVICE_HANDLER_DEMO */ #endif /* OBSW_ADD_DEVICE_HANDLER_DEMO */
} }
void assemblyDemo(HasModesIF* assembly) {
CommandMessage modeMessage;
ModeMessage::setModeMessage(&modeMessage, ModeMessage::CMD_MODE_COMMAND,
DeviceHandlerIF::MODE_NORMAL,
TestAssembly::submodes::DUAL);
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "Commanding Test Assembly to Normal, Dual" << std::endl;
#else
sif::printInfo("Commanding Test Assembly to Normal, Dual \n");
#endif
MessageQueueSenderIF::sendMessage(assembly->getCommandQueue(), &modeMessage,
MessageQueueIF::NO_QUEUE);
}

View File

@ -51,17 +51,19 @@ void ObjectFactory::produce(void *args) {
new PoolManager(objects::IPC_STORE, poolCfg); new PoolManager(objects::IPC_STORE, poolCfg);
} }
#if OBSW_ADD_LWIP_COMPONENTS == 1
/* UDP Server */ /* UDP Server */
new TmTcLwIpUdpBridge(objects::UDP_BRIDGE, objects::CCSDS_DISTRIBUTOR, new TmTcLwIpUdpBridge(objects::UDP_BRIDGE, objects::CCSDS_DISTRIBUTOR,
objects::TM_STORE, objects::TC_STORE); objects::TM_STORE, objects::TC_STORE);
new UdpTcLwIpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE, new UdpTcLwIpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE,
&gnetif); &gnetif);
#endif
#endif /* OBSW_ADD_CORE_COMPONENTS == 1 */ #endif /* OBSW_ADD_CORE_COMPONENTS == 1 */
ObjectFactory::produceGenericObjects(); ObjectFactory::produceGenericObjects();
/* Test Device Handler */ /* Test Device Handler */
new STM32TestTask(objects::TEST_TASK, false, true); new STM32TestTask(objects::TEST_TASK, true, true);
#if OBSW_PERFORM_L3GD20H_TEST == 1 #if OBSW_PERFORM_L3GD20H_TEST == 1

View File

@ -1,6 +1,4 @@
#include "OBSWConfig.h" #include "OBSWConfig.h"
#include "OBSWVersion.h"
#include "boardconfig.h"
#include "hardware_init.h" #include "hardware_init.h"
#if OBSW_ADD_LWIP_COMPONENTS == 1 #if OBSW_ADD_LWIP_COMPONENTS == 1
@ -16,7 +14,6 @@
#include <fsfw/serviceinterface/ServiceInterface.h> #include <fsfw/serviceinterface/ServiceInterface.h>
#include <fsfw/tasks/TaskFactory.h> #include <fsfw/tasks/TaskFactory.h>
#include "FreeRTOS.h"
#include "cmsis_os.h" #include "cmsis_os.h"
#include "task.h" #include "task.h"
@ -52,8 +49,7 @@ int main() {
osKernelStart(); osKernelStart();
/* Should not be reached, scheduler should now be running. */ /* Should not be reached, scheduler should now be running. */
for (;;) { for (;;) {}
}
return 0; return 0;
} }
@ -84,5 +80,5 @@ void initTask(void *parameters) {
sif::printInfo("Creating tasks..\n\r"); sif::printInfo("Creating tasks..\n\r");
#endif #endif
InitMission::createTasks(); InitMission::createTasks();
TaskFactory::instance()->deleteTask(nullptr); TaskFactory::deleteTask(nullptr);
} }

2
fsfw

@ -1 +1 @@
Subproject commit a5245d55866af138b1f2d86d560b59f3a1bd3255 Subproject commit 44402883b509f2116d48269edff3068a63c4c204