*optimize build for 16K targets

This commit is contained in:
moonglow 2021-06-17 15:37:17 +03:00
parent 43533b5b4a
commit ef937a446a
3 changed files with 5 additions and 4 deletions

View File

@ -62,7 +62,7 @@ _Min_Stack_Size = 0x200; /* required amount of stack */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 6K
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 32K
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 16K
}
/* Define output sections */

View File

@ -199,11 +199,11 @@ static uint8_t device_setup( USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *re
{
case 0: /* bootloader info */
{
uint8_t bootloader_info[] = {
static const uint8_t bootloader_info[] = {
0x00, 0x00, 0x08, 0x04, 0x00, 0x08, 0x07, 0x00,
0x04, 0x02, 0xe0, 0x07, 0x01, 0x00, 0x00, 0x00
};
USBD_CtlSendData( pdev, bootloader_info, sizeof( bootloader_info ) );
USBD_CtlSendData( pdev, (void*)bootloader_info, sizeof( bootloader_info ) );
pcan_led_set_mode( LED_CH0_RX, LED_MODE_ON, 0 );
pcan_led_set_mode( LED_CH0_TX, LED_MODE_ON, 0 );

View File

@ -62,7 +62,8 @@ uint8_t * USBD_FS_LangIDStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
uint8_t * USBD_FS_HugeStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length)
{
UNUSED( speed );
__ALIGN_BEGIN static const uint16_t huge_descriptor[1+126] __ALIGN_END = { 0x03FE };
/* little hack to save some flash memory */
__ALIGN_BEGIN static const uint16_t huge_descriptor[1/*+126*/] __ALIGN_END = { 0x03FE };
*length = sizeof( huge_descriptor );
return (uint8_t*)huge_descriptor;
}