diff --git a/include/motion_pages.h b/include/motion_pages.h new file mode 100644 index 0000000000000000000000000000000000000000..d90bb68525816304ed462dc74f293807c74c35b4 --- /dev/null +++ b/include/motion_pages.h @@ -0,0 +1,45 @@ +#ifndef _MOTION_PAGES_H +#define _MOTION_PAGES_H + +#include "stm32f4xx.h" + +#define MAX_PAGES 128 +#define PAGE_MAX_NUM_SERVOS 31 +#define POSE_NUMBER_OF_POSES_PER_PAGE 7 + +typedef struct // Header Structure (total 64unsigned char) +{ + uint8_t name[13]; // Name 0~13 + uint8_t reserved1; // Reserved1 14 + uint8_t repeat; // Repeat count 15 + uint8_t schedule; // schedule 16 + uint8_t reserved2[3]; // reserved2 17~19 + uint8_t stepnum; // Number of step 20 + uint8_t reserved3; // reserved3 21 + uint8_t speed; // Speed 22 + uint8_t reserved4; // reserved4 23 + uint8_t accel; // Acceleration time 24 + uint8_t next; // Link to next 25 + uint8_t exit; // Link to exit 26 + uint8_t reserved5[4]; // reserved5 27~30 + uint8_t checksum; // checksum 31 + uint8_t slope[PAGE_MAX_NUM_SERVOS]; // CW/CCW compliance slope 32~62 + uint8_t reserved6; // reserved6 63 +} TPageHeader; + +typedef struct // Step Structure (total 64unsigned char) +{ + uint16_t position[PAGE_MAX_NUM_SERVOS]; // Joint position 0~61 + uint8_t pause; // Pause time 62 + uint8_t time; // Time 63 +} TStep; + +typedef struct // Page Structure (total 512unsigned char) +{ + TPageHeader header; // Page header 0~64 + TStep steps[POSE_NUMBER_OF_POSES_PER_PAGE]; // Page step 65~511 +} TPage; + +extern TPage motion_pages[MAX_PAGES]; + +#endif diff --git a/linker_script/STM32F4_1024FLASH_192RAM.ld b/linker_script/STM32F4_1024FLASH_192RAM.ld index 540f0b978714910357480af367ee54e4de4ec718..093b73a8abd7193bdfaa98f40fe0d5413190da68 100644 --- a/linker_script/STM32F4_1024FLASH_192RAM.ld +++ b/linker_script/STM32F4_1024FLASH_192RAM.ld @@ -42,7 +42,8 @@ MEMORY { FLASH1 (rx) : ORIGIN = 0x08000000, LENGTH = 16K EEPROM (rw) : ORIGIN = 0x08004000, LENGTH = 32K -FLASH2 (rx) : ORIGIN = 0x0800C000, LENGTH = 976K +FLASH2 (rx) : ORIGIN = 0x0800C000, LENGTH = 848K +PAGES (rx) : ORIGIN = 0x080E0000, LENGTH = 128K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K CCMRAM (rw) : ORIGIN = 0x10000000, LENGTH = 64K } @@ -153,6 +154,12 @@ SECTIONS _eccmram = .; /* create a global symbol at ccmram end */ } >CCMRAM AT> FLASH2 + .pages : + { + . = ALIGN(4); + *(.pages) + . = ALIGN(4); + } >PAGES /* Uninitialized data section */ . = ALIGN(4); diff --git a/src/motion_pages.c b/src/motion_pages.c new file mode 100644 index 0000000000000000000000000000000000000000..f75a1a8dbf1b9dbfd5a0dc20850e98fb39d5a337 --- /dev/null +++ b/src/motion_pages.c @@ -0,0 +1,3 @@ +#include "motion_pages.h" + +TPage motion_pages[MAX_PAGES] __attribute__ ((section (".pages")));