Part Number: LP-MSPM0L1306
Other Parts Discussed in Thread: MSPM0L1306, SYSCONFIG
Tool/software:
Hi,
I use reference project "gpio_toggle_output_LP_MSPM0L1306_nortos_ticlang" from sdk 2.6.0.5.
before I add malloc(). SRAM only uses 256B.

after I add malloc(). SRAM becomes 2319.

I only allocate 100B memory as below.
/*
* Copyright (c) 2023, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "ti_msp_dl_config.h"
#include <stdlib.h>
#include <string.h>
/* This results in approximately 0.5s of delay assuming 32MHz CPU_CLK */
#define DELAY (16000000)
uint16_t tmptmp;
int main(void)
{
uint16_t i=0;
uint16_t *tmpbuf= (uint16_t *)malloc(100);;
//uint16_t tmpbuf[100];
if(!tmpbuf){
free(tmpbuf);
DL_GPIO_setPins(GPIO_LEDS_PORT,
GPIO_LEDS_USER_LED_1_PIN | GPIO_LEDS_USER_LED_2_PIN |
GPIO_LEDS_USER_LED_3_PIN | GPIO_LEDS_USER_TEST_PIN);
__BKPT(0);
}
#if 1 // Ammore Test
memset(tmpbuf,0x00,100);
for(i=0;i<100;i++)
{
tmpbuf[i] = tmpbuf[0] + 1;
}
#endif
/* Power on GPIO, initialize pins as digital outputs */
SYSCFG_DL_init();
/* Default: LED1 and LED3 ON, LED2 OFF */
DL_GPIO_clearPins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_2_PIN);
DL_GPIO_setPins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN |
GPIO_LEDS_USER_LED_3_PIN |
GPIO_LEDS_USER_TEST_PIN);
while (1) {
/*
* Call togglePins API to flip the current value of LEDs 1-3. This
* API causes the corresponding HW bits to be flipped by the GPIO HW
* without need for additional R-M-W cycles by the processor.
*/
if((i++)<=1024){
uint16_t tmp = i;
//temp[i]=tmp++;
tmpbuf[i] = tmp++;
__asm("NOP");
}else{
i=0;
// temp[i]=i;
tmpbuf[i] = i;
__asm("NOP");
}
delay_cycles(DELAY);
DL_GPIO_togglePins(GPIO_LEDS_PORT,
GPIO_LEDS_USER_LED_1_PIN | GPIO_LEDS_USER_LED_2_PIN |
GPIO_LEDS_USER_LED_3_PIN | GPIO_LEDS_USER_TEST_PIN);
tmptmp = tmpbuf[i];
}
}
any idea?
BR,
frank