From e6cd32a1adf5417b54c11c6ee015a5f2a9764989 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Fri, 24 Dec 2021 16:24:45 -0500 Subject: [kernel] 将rt_thread_timeout设置为私有函数 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/rtthread.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/rtthread.h b/include/rtthread.h index 393b40b1b6..d18355c426 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -155,7 +155,6 @@ rt_err_t rt_thread_mdelay(rt_int32_t ms); rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg); rt_err_t rt_thread_suspend(rt_thread_t thread); rt_err_t rt_thread_resume(rt_thread_t thread); -void rt_thread_timeout(void *parameter); #ifdef RT_USING_SIGNALS void rt_thread_alloc_sig(rt_thread_t tid); -- cgit v1.3.1 From e8f4208bb2e3e17c641836dc6a6c72a836f17943 Mon Sep 17 00:00:00 2001 From: Wayne Lin Date: Tue, 28 Dec 2021 13:37:04 +0800 Subject: Update LVGLv81 porting. 1. Add RTGRAPHIC_CTRL_PAN_DISPLAY and RTGRAPHIC_CTRL_WAIT_VSYNC control command. 2. Add calibration data of 480x272 ADC touching. 3. Add 480x272 LCD panel menu option and driver. 4. Update lv_conf.h. --- bsp/nuvoton/libraries/n9h30/Driver/Include/nu_2d.h | 6 +- .../libraries/n9h30/Driver/Include/nu_lcd.h | 64 +++++++- bsp/nuvoton/libraries/n9h30/Driver/Source/nu_lcd.c | 68 ++++++++- bsp/nuvoton/libraries/n9h30/rtt_port/Kconfig | 11 +- .../libraries/n9h30/rtt_port/drv_adc_touch.c | 24 ++- bsp/nuvoton/libraries/n9h30/rtt_port/drv_vpost.c | 42 ++++-- bsp/nuvoton/nk-980iot/applications/lvgl/lv_conf.h | 8 +- bsp/nuvoton/nk-n9h30/applications/lvgl/lv_conf.h | 7 +- .../nk-n9h30/applications/lvgl/lv_port_disp.c | 168 +++++++++++++++------ include/rtdef.h | 2 + 10 files changed, 318 insertions(+), 82 deletions(-) (limited to 'include') diff --git a/bsp/nuvoton/libraries/n9h30/Driver/Include/nu_2d.h b/bsp/nuvoton/libraries/n9h30/Driver/Include/nu_2d.h index 36275b15ea..8844f5040b 100644 --- a/bsp/nuvoton/libraries/n9h30/Driver/Include/nu_2d.h +++ b/bsp/nuvoton/libraries/n9h30/Driver/Include/nu_2d.h @@ -30,8 +30,8 @@ extern "C" /// @cond HIDDEN_SYMBOLS typedef struct { - UINT32 PatternA; - UINT32 PatternB; + uint32_t PatternA; + uint32_t PatternB; } MONOPATTERN; #define COLOR_KEY 0xFF000000 @@ -169,7 +169,7 @@ void ge2dSpriteBltx_ScreenRop(int x, int y, int sprite_sx, int sprite_sy, int wi void ge2dColorExpansionBlt(int x, int y, int width, int height, int fore_color, int back_color, int opt, void *buf); void ge2dHostColorExpansionBlt(int x, int y, int width, int height, int fore_color, int back_color, int opt, void *buf); void ge2dInitMonoPattern(int opt, int fore_color, int back_color); -void ge2dInitMonoInputPattern(UINT32 PatternA, UINT32 PatternB, int fore_color, int back_color); +void ge2dInitMonoInputPattern(uint32_t PatternA, uint32_t PatternB, int fore_color, int back_color); void ge2dInitColorPattern(int patformat, void *patdata); void ge2dFont_PutChar(int x, int y, char asc_code, int fore_color, int back_color, int draw_mode, int font_id); void ge2dFont_PutString(int x, int y, char *str, int fore_color, int back_color, int draw_mode, int font_id); diff --git a/bsp/nuvoton/libraries/n9h30/Driver/Include/nu_lcd.h b/bsp/nuvoton/libraries/n9h30/Driver/Include/nu_lcd.h index bffcdcd589..bf05c3f9a9 100644 --- a/bsp/nuvoton/libraries/n9h30/Driver/Include/nu_lcd.h +++ b/bsp/nuvoton/libraries/n9h30/Driver/Include/nu_lcd.h @@ -139,6 +139,8 @@ extern "C" #define VA_SCALE_INTERPOLATION (0) /*!< Scale mode is interpolation */ #define VA_SCALE_DUPLICATION (1<<15) /*!< Scale mode is duplication */ +#pragma anon_unions + typedef enum va_hcmode_e { HC_MODE0, /*!< 32X32X2bpp 4 color */ @@ -173,6 +175,7 @@ typedef struct #define DIS_PANEL_ILI9341_MPU80 1 #define DIS_LSA40AT9001 2 #define DIS_PANEL_FW070TFT 3 +#define DIS_PANEL_FW043TFT 4 typedef struct { uint32_t u32DevWidth; /*!< Panel width */ @@ -184,11 +187,62 @@ typedef struct uint32_t u32MPU_Mode; /*!< MPU mode */ uint32_t u32DisplayColors; /*!< Display colors */ uint32_t u32DevType; /*!< Type of display panel */ - uint32_t u32Reg_CRTCSIZE; /*!< CRTCSIZE register value */ - uint32_t u32Reg_CRTCDEND; /*!< CRTCDEND register value */ - uint32_t u32Reg_CRTCHR; /*!< CRTCHR register value */ - uint32_t u32Reg_CRTCHSYNC; /*!< CRTCHSYNC register value */ - uint32_t u32Reg_CRTCVR; /*!< CRTCVR register value */ + union + { + uint32_t u32Reg_CRTCSIZE; /*!< CRTCSIZE register value */ + struct + { + uint32_t HTT: 11; /*!< Horizontal Total Pixels */ + uint32_t : 5; + uint32_t VTT: 11; /*!< Vertical Total Scan Lines */ + uint32_t : 5; + } sCRTCSIZE; + }; + union + { + uint32_t u32Reg_CRTCDEND; /*!< CRTCDEND register value */ + struct + { + uint32_t HDEND: 11; /*!< Horizontal Display Enable End */ + uint32_t : 5; + uint32_t VDEND: 11; /*!< Vertical Display Enable End */ + uint32_t : 5; + } sCRTCDEND; + }; + union + { + uint32_t u32Reg_CRTCHR; /*!< CRTCHR register value */ + struct + { + uint32_t HRS: 11; /*!< Internal Horizontal Retrace Start Timing */ + uint32_t : 5; + uint32_t HRE: 11; /*!< Internal Horizontal Retrace End Low */ + uint32_t : 5; + } sCRTCHR; + }; + union + { + uint32_t u32Reg_CRTCHSYNC; /*!< CRTCHSYNC register value */ + struct + { + uint32_t HSYNC_S: 11; /*!< Horizontal Sync Start Timing */ + uint32_t : 5; + uint32_t HSYNC_E: 11; /*!< Horizontal Sync End Timing */ + uint32_t : 3; + uint32_t HSYNC_SHIFT: 2; /*!< Hsync Signal Adjustment For Multi-Cycles Per Pixel Mode Of Sync-Based Unipac-LCD */ + } sCRTCHSYNC; + }; + union + { + uint32_t u32Reg_CRTCVR; /*!< CRTCVR register value */ + struct + { + uint32_t VRS: 11; /*!< Vertical Internal Retrace Start Timing */ + uint32_t : 5; + uint32_t VRE: 11; /*!< Vertical Internal Retrace End Low */ + uint32_t : 5; + } sCRTCVR; + }; } VPOST_T; #define LCM_ERR_ID 0xFFFF0400 /*!< LCM library ID */ diff --git a/bsp/nuvoton/libraries/n9h30/Driver/Source/nu_lcd.c b/bsp/nuvoton/libraries/n9h30/Driver/Source/nu_lcd.c index 423d03ec56..d71d110096 100644 --- a/bsp/nuvoton/libraries/n9h30/Driver/Source/nu_lcd.c +++ b/bsp/nuvoton/libraries/n9h30/Driver/Source/nu_lcd.c @@ -103,8 +103,74 @@ static VPOST_T DEF_FW070TFT = 0x020001f6 /*!< CRTCVR register value */ }; +#define FW043TFT_WIDTH 480 /*!< XRES */ +#define FW043TFT_HEIGHT 272 /*!< YRES */ +#define FW043TFT_MARGIN_LEFT 30 /*!< HBP (Horizontal Back Porch) */ +#define FW043TFT_MARGIN_RIGHT 5 /*!< HFP (Horizontal Front Porch) */ +#define FW043TFT_MARGIN_UPPER 2 /*!< VBP (Vertical Back Porch) */ +#define FW043TFT_MARGIN_LOWER 27 /*!< VFP (Vertical Front Porch) */ +#define FW043TFT_HSYNC_LEN 41 /*!< HPW (HSYNC plus width) */ +#define FW043TFT_VSYNC_LEN 10 /*!< VPW (VSYNC width) */ +static VPOST_T DEF_FW043TFT = +{ + FW043TFT_WIDTH, /*!< Panel width */ + FW043TFT_HEIGHT, /*!< Panel height */ + 0, /*!< MPU command line low indicator */ + 0, /*!< MPU command width */ + 0, /*!< MPU bus width */ + VPOSTB_DATA16or18, /*!< Display bus width */ + 0, /*!< MPU mode */ + VPOSTB_COLORTYPE_16M, /*!< Display colors */ + VPOSTB_DEVICE_SYNC_HIGHCOLOR, /*!< Type of display panel */ + + .sCRTCSIZE = + { + /*!< Horizontal Total */ + .HTT = FW043TFT_MARGIN_LEFT + FW043TFT_WIDTH + FW043TFT_MARGIN_RIGHT, + + /*!< Vertical Total */ + .VTT = FW043TFT_MARGIN_UPPER + FW043TFT_HEIGHT + FW043TFT_MARGIN_LOWER, + }, + .sCRTCDEND = + { + /*!< Horizontal Display Enable End */ + .HDEND = FW043TFT_WIDTH, + + /*!< Vertical Display Enable End */ + .VDEND = FW043TFT_HEIGHT, + }, + .sCRTCHR = + { + /*!< Internal Horizontal Retrace Start Timing */ + .HRS = FW043TFT_WIDTH + 1, + + /*!< Internal Horizontal Retrace End Low */ + .HRE = FW043TFT_WIDTH + 5, + }, + .sCRTCHSYNC = + { + /*!< Horizontal Sync Start Timing */ + .HSYNC_S = FW043TFT_WIDTH + FW043TFT_MARGIN_LEFT, + + /*!< Horizontal Sync End Timing */ + .HSYNC_E = FW043TFT_WIDTH + FW043TFT_MARGIN_LEFT + FW043TFT_HSYNC_LEN, + + /*!< Hsync Signal Adjustment For Multi-Cycles Per Pixel Mode Of Sync-Based Unipac-LCD */ + .HSYNC_SHIFT = 0, + }, + .sCRTCVR = + { + /*!< Vertical Internal Retrace Start Timing */ + .VRS = FW043TFT_HEIGHT + FW043TFT_MARGIN_UPPER, + + /*!< Vertical Internal Retrace End Low */ + .VRE = FW043TFT_HEIGHT + FW043TFT_MARGIN_UPPER + FW043TFT_VSYNC_LEN, + } +}; + + /* LCD build-in support list */ -static VPOST_T *DisplayDevList[4] = {&DEF_E50A2V1, &DEF_ILI9341_MPU80, &DEF_LSA40AT9001, &DEF_FW070TFT}; +static VPOST_T *DisplayDevList[5] = {&DEF_E50A2V1, &DEF_ILI9341_MPU80, &DEF_LSA40AT9001, &DEF_FW070TFT, &DEF_FW043TFT}; static VPOST_T curDisplayDev; static OSDFORMATEX curOSDDev = {0}; static LCDFORMATEX curVADev = {0}; diff --git a/bsp/nuvoton/libraries/n9h30/rtt_port/Kconfig b/bsp/nuvoton/libraries/n9h30/rtt_port/Kconfig index 54ba33049a..7b898c79b5 100644 --- a/bsp/nuvoton/libraries/n9h30/rtt_port/Kconfig +++ b/bsp/nuvoton/libraries/n9h30/rtt_port/Kconfig @@ -464,13 +464,16 @@ config SOC_SERIES_N9H30 prompt "Select Supported LCM panel" default LCM_USING_FW070TFT config LCM_USING_E50A2V1 - bool "LCM_E50A2V1(800x480x2)" + bool "LCM_E50A2V1(800x480-RGB565)" config LCM_USING_LSA40AT9001 - bool "LCM_LSA40AT9001(800x600x2)" + bool "LCM_LSA40AT9001(800x600-RGB565)" config LCM_USING_FW070TFT - bool "LCM_FW070TFT(800x480x4)" + bool "LCM_FW070TFT(800x480-RGB888)" + + config LCM_USING_FW043TFT + bool "LCM_FW043TFT(480x272-RGB888)" endchoice @@ -480,6 +483,7 @@ config SOC_SERIES_N9H30 default 2 if LCM_USING_LSA40AT9001 default 3 if LCM_USING_FW070TFT + default 4 if LCM_USING_FW043TFT config LCM_USING_BPP int @@ -487,6 +491,7 @@ config SOC_SERIES_N9H30 default 2 if LCM_USING_LSA40AT9001 default 4 if LCM_USING_FW070TFT + default 4 if LCM_USING_FW043TFT config BSP_USING_VPOST_OSD bool "Enable VPOST OSD layer" diff --git a/bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc_touch.c b/bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc_touch.c index 5896a9b962..fb1f4433cf 100644 --- a/bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc_touch.c +++ b/bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc_touch.c @@ -29,7 +29,21 @@ typedef nu_adc_touch *nu_adc_touch_t; static nu_adc_touch s_NuAdcTouch = {0}; #define DEF_CALDATA_LENGTH 7 -static int cal_data_a[DEF_CALDATA_LENGTH] = { 13230, -66, -1161952, -85, 8600, -1636996, 65536 }; + +#if defined(LCM_USING_FW043TFT) + #define LCM_WIDTH 480 + #define LCM_HEIGHT 272 + static int cal_data_a[DEF_CALDATA_LENGTH] = { 8824, -34, -2261272, -70, -6302, 21805816, 65536 }; +#else + #define LCM_WIDTH 800 + #define LCM_HEIGHT 480 + #if defined(LCM_USING_FW070TFT) + static int cal_data_a[DEF_CALDATA_LENGTH] = { 13230, -66, -1161952, -85, 8600, -1636996, 65536 }; + #else + static int cal_data_a[DEF_CALDATA_LENGTH] = { 1, 0, 0, 0, 1, 0, 1 }; + #endif +#endif + static const int cal_zero[DEF_CALDATA_LENGTH] = { 1, 0, 0, 0, 1, 0, 1 }; static void nu_adc_touch_cal(int *sumx, int *sumy) @@ -152,8 +166,8 @@ int rt_hw_adc_touch_init(void) s_NuAdcTouch.dev.info.type = RT_TOUCH_TYPE_RESISTANCE; s_NuAdcTouch.dev.info.vendor = RT_TOUCH_VENDOR_UNKNOWN; s_NuAdcTouch.dev.info.point_num = 1; - s_NuAdcTouch.dev.info.range_x = 800; - s_NuAdcTouch.dev.info.range_x = 480; + s_NuAdcTouch.dev.info.range_x = LCM_WIDTH; + s_NuAdcTouch.dev.info.range_y = LCM_HEIGHT; s_NuAdcTouch.dev.ops = &touch_ops; @@ -189,11 +203,11 @@ static void adc_touch_entry(void *parameter) result = rt_device_set_rx_indicate(pdev, adc_touch_rx_callback); RT_ASSERT(result == RT_EOK); - max_range = 800; + max_range = LCM_WIDTH; result = rt_device_control(pdev, RT_TOUCH_CTRL_SET_X_RANGE, (void *)&max_range); RT_ASSERT(result == RT_EOK); - max_range = 480; + max_range = LCM_HEIGHT; result = rt_device_control(pdev, RT_TOUCH_CTRL_SET_Y_RANGE, (void *)&max_range); RT_ASSERT(result == RT_EOK); diff --git a/bsp/nuvoton/libraries/n9h30/rtt_port/drv_vpost.c b/bsp/nuvoton/libraries/n9h30/rtt_port/drv_vpost.c index b25eab57ec..398596ef13 100644 --- a/bsp/nuvoton/libraries/n9h30/rtt_port/drv_vpost.c +++ b/bsp/nuvoton/libraries/n9h30/rtt_port/drv_vpost.c @@ -22,7 +22,7 @@ /* Private typedef --------------------------------------------------------------*/ -#define DEF_VPOST_BUFFER_NUMBER 2 +#define DEF_VPOST_BUFFER_NUMBER 3 typedef enum { @@ -157,12 +157,12 @@ static rt_err_t vpost_layer_control(rt_device_t dev, int cmd, void *args) } break; - /* FBIO_PANDISPLAY + WAIT_VSYNC Mechanism */ - case RTGRAPHIC_CTRL_RECT_UPDATE: + case RTGRAPHIC_CTRL_PAN_DISPLAY: { if (args != RT_NULL) { uint8_t *pu8BufPtr = (uint8_t *)args; + g_u32VSyncLastCommit = g_u32VSyncBlank; /* Pan display */ @@ -182,20 +182,27 @@ static rt_err_t vpost_layer_control(rt_device_t dev, int cmd, void *args) return -RT_ERROR; } - /*Wait sync*/ - while (g_u32VSyncLastCommit == g_u32VSyncBlank) - { - rt_completion_init(&vsync_wq); - rt_completion_wait(&vsync_wq, RT_TICK_PER_SECOND / 60); - } } else return -RT_ERROR; } break; + case RTGRAPHIC_CTRL_WAIT_VSYNC: + { + if (args != RT_NULL) + g_u32VSyncLastCommit = g_u32VSyncBlank+1; + + if (g_u32VSyncLastCommit >= g_u32VSyncBlank) + { + rt_completion_init(&vsync_wq); + rt_completion_wait(&vsync_wq, RT_TICK_PER_SECOND / 60); + } + } + break; + default: - break; + return -RT_ERROR; } return RT_EOK; @@ -254,8 +261,19 @@ int rt_hw_vpost_init(void) VPOST_T *psVpostLcmInst = vpostLCMGetInstance(VPOST_USING_LCD_IDX); RT_ASSERT(psVpostLcmInst != RT_NULL); - /* LCD clock is selected from UPLL and divide to 20MHz */ - outpw(REG_CLK_DIVCTL1, (inpw(REG_CLK_DIVCTL1) & ~0xff1f) | 0xE18); + if ( (psVpostLcmInst->u32DevWidth * psVpostLcmInst->u32DevHeight) > (480*272) ) + { + /* LCD clock is selected from UPLL and divide to 20MHz */ + outpw(REG_CLK_DIVCTL1, (inpw(REG_CLK_DIVCTL1) & ~0xff1f) | 0xE18); + + /* LCD clock is selected from UPLL and divide to 30MHz */ + //outpw(REG_CLK_DIVCTL1, (inpw(REG_CLK_DIVCTL1) & ~0xff1f) | 0x918); + } + else + { + /* LCD clock is selected from UPLL and divide to 10MHz */ + outpw(REG_CLK_DIVCTL1, (inpw(REG_CLK_DIVCTL1) & ~0xff1f) | 0xE19); + } /* Initial LCM */ vpostLCMInit(VPOST_USING_LCD_IDX); diff --git a/bsp/nuvoton/nk-980iot/applications/lvgl/lv_conf.h b/bsp/nuvoton/nk-980iot/applications/lvgl/lv_conf.h index b89513bc70..9c2479dc5c 100644 --- a/bsp/nuvoton/nk-980iot/applications/lvgl/lv_conf.h +++ b/bsp/nuvoton/nk-980iot/applications/lvgl/lv_conf.h @@ -11,20 +11,18 @@ #ifndef LV_CONF_H #define LV_CONF_H - #define LV_USE_PERF_MONITOR 1 #define LV_COLOR_DEPTH 16 #define LV_HOR_RES_MAX (320) #define LV_VER_RES_MAX (240) - -#define LV_USE_DEMO_RTT_MUSIC 1 -#define LV_USE_DEMO_MUSIC 1 #define LV_FONT_MONTSERRAT_12 1 #define LV_FONT_MONTSERRAT_16 1 -#define LV_DEMO_MUSIC_AUTO_PLAY 1 +#define LV_USE_DEMO_RTT_MUSIC 1 #define LV_DEMO_RTT_MUSIC_AUTO_PLAY 1 +#define LV_DISP_DEF_REFR_PERIOD 16 + //#define CONFIG_LV_LOG_LEVEL LV_LOG_LEVEL_TRACE #endif diff --git a/bsp/nuvoton/nk-n9h30/applications/lvgl/lv_conf.h b/bsp/nuvoton/nk-n9h30/applications/lvgl/lv_conf.h index 9b96e21b8d..cb73e49358 100644 --- a/bsp/nuvoton/nk-n9h30/applications/lvgl/lv_conf.h +++ b/bsp/nuvoton/nk-n9h30/applications/lvgl/lv_conf.h @@ -19,13 +19,12 @@ #define LV_HOR_RES_MAX (800) #define LV_VER_RES_MAX (480) - -#define LV_USE_DEMO_RTT_MUSIC 1 -#define LV_USE_DEMO_MUSIC 1 #define LV_FONT_MONTSERRAT_12 1 #define LV_FONT_MONTSERRAT_16 1 -#define LV_DEMO_MUSIC_AUTO_PLAY 1 +#define LV_USE_DEMO_RTT_MUSIC 1 #define LV_DEMO_RTT_MUSIC_AUTO_PLAY 1 +//#define LV_DISP_DEF_REFR_PERIOD 16 + //#define CONFIG_LV_LOG_LEVEL LV_LOG_LEVEL_TRACE #endif diff --git a/bsp/nuvoton/nk-n9h30/applications/lvgl/lv_port_disp.c b/bsp/nuvoton/nk-n9h30/applications/lvgl/lv_port_disp.c index 51615b09b7..193c9fddc3 100644 --- a/bsp/nuvoton/nk-n9h30/applications/lvgl/lv_port_disp.c +++ b/bsp/nuvoton/nk-n9h30/applications/lvgl/lv_port_disp.c @@ -8,6 +8,7 @@ * 2021-12-17 Wayne The first version */ #include +#include "nu_2d.h" #define LOG_TAG "lvgl.disp" #define DBG_ENABLE @@ -22,50 +23,112 @@ static rt_device_t lcd_device = 0; static struct rt_device_graphic_info info; static lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/ -extern void ge2dInit(int bpp, int width, int height, void *destination); -extern void ge2dSpriteBlt_Screen(int destx, int desty, int sprite_width, int sprite_height, void *buf); -extern int ge2dBitblt_SetAlphaMode(int opt, int ks, int kd); -extern void ge2dSpriteBltx_Screen(int x, int y, int sprite_sx, int sprite_sy, int width, int height, int sprite_width, int sprite_height, void *buf); -extern void ge2dClip_SetClip(int x1, int y1, int x2, int y2); -extern void ge2dFill_Solid_RGB565(int dx, int dy, int width, int height, int color); -extern void ge2dFill_Solid(int dx, int dy, int width, int height, int color); +static void nu_flush_direct(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p) +{ + lv_disp_t *psDisp = _lv_refr_get_disp_refreshing(); + void *pvDstReDraw; + + /* Use PANDISPLAY */ + rt_device_control(lcd_device, RTGRAPHIC_CTRL_PAN_DISPLAY, color_p); + + /* Need to do on-/off- screen buffer synchronization. Here, we do a source-copying using GE2D engine. */ + if (disp_drv->draw_buf->buf1 == color_p) + pvDstReDraw = disp_drv->draw_buf->buf2; + else + pvDstReDraw = disp_drv->draw_buf->buf1; + + // Enter GE2D -> + ge2dInit(sizeof(lv_color_t) * 8, info.width, info.height, pvDstReDraw); + ge2dBitblt_SetAlphaMode(-1, 0, 0); + ge2dBitblt_SetDrawMode(-1, 0, 0); + ge2dSpriteBlt_Screen(0, 0, info.width, info.height, (void *)color_p); + // -> Leave GE2D + + /* WAIT_VSYNC */ + rt_device_control(lcd_device, RTGRAPHIC_CTRL_WAIT_VSYNC, RT_NULL); + + lv_disp_flush_ready(disp_drv); +} -static void lcd_fb_flush(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p) +static void nu_flush_full_refresh(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p) { - /* Use ping-pong buffer updating without memory-copy. */ - rt_device_control(lcd_device, RTGRAPHIC_CTRL_RECT_UPDATE, color_p); + /* Use PANDISPLAY+WAIT_VSYNC without H/W copying. */ + rt_device_control(lcd_device, RTGRAPHIC_CTRL_PAN_DISPLAY, color_p); + rt_device_control(lcd_device, RTGRAPHIC_CTRL_WAIT_VSYNC, RT_NULL); lv_disp_flush_ready(disp_drv); } -void ge2d_fill_cb(struct _lv_disp_drv_t *disp_drv, lv_color_t *dest_buf, lv_coord_t dest_width, - const lv_area_t *fill_area, lv_color_t color) +static void nu_flush(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p) { - int32_t act_x1 = fill_area->x1 < 0 ? 0 : fill_area->x1; - int32_t act_y1 = fill_area->y1 < 0 ? 0 : fill_area->y1; - int32_t act_x2 = fill_area->x2 > info.width - 1 ? info.width - 1 : fill_area->x2; - int32_t act_y2 = fill_area->y2 > info.height - 1 ? info.height - 1 : fill_area->y2; - int32_t fill_area_w = act_x2 - act_x1 + 1; - int32_t fill_area_h = act_y2 - act_y1 + 1; + int32_t flush_area_w = lv_area_get_width(area); + int32_t flush_area_h = lv_area_get_height(area); + //rt_kprintf("[%s %08x] %dx%d %d %d %d %d\n", __func__, color_p, flush_area_w, flush_area_h, area->x1, area->y1, area->x2, area->y2 ); + + /* Update dirty region. */ // Enter GE2D -> - ge2dInit(sizeof(lv_color_t) * 8, info.width, info.height, (void *)dest_buf); - ge2dClip_SetClip(act_x1, act_y1, act_x2, act_y2); - if (sizeof(lv_color_t) == 4) + ge2dInit(sizeof(lv_color_t) * 8, info.width, info.height, (void *)info.framebuffer); + ge2dBitblt_SetAlphaMode(-1, 0, 0); + ge2dBitblt_SetDrawMode(-1, 0, 0); + + ge2dSpriteBlt_Screen(area->x1, area->y1, flush_area_w, flush_area_h, (void *)color_p); + // -> Leave GE2D + + lv_disp_flush_ready(disp_drv); +} + + +static void nu_fill_cb(struct _lv_disp_drv_t *disp_drv, lv_color_t *dest_buf, lv_coord_t dest_width, + const lv_area_t *fill_area, lv_color_t color) +{ + int32_t fill_area_w = lv_area_get_width(fill_area); + int32_t fill_area_h = lv_area_get_height(fill_area); + + //rt_kprintf("[%s %08x] %dx%d %d %d %d %d\n", __func__, dest_buf, fill_area_w, fill_area_h, fill_area->x1, fill_area->y1, fill_area->x2, fill_area->y2 ); + + if (lv_area_get_size(fill_area) < 3600) { - ge2dFill_Solid(act_x1, act_y1, fill_area_w, fill_area_h, color.full); + /*Software filling*/ + int y; + lv_color_t *disp_buf_first = dest_buf + dest_width * fill_area->y1 + fill_area->x1; + for (y = 0; y < fill_area_h; y++) + { + lv_color_fill(disp_buf_first, color, fill_area_w); + disp_buf_first += dest_width; + } } - else if (sizeof(lv_color_t) == 2) + else { - ge2dFill_Solid_RGB565(act_x1, act_y1, fill_area_w, fill_area_h, color.full); + /*Hardware filling*/ + if (disp_drv->direct_mode || disp_drv->full_refresh) + { + // Enter GE2D -> + ge2dInit(sizeof(lv_color_t) * 8, info.width, info.height, (void *)dest_buf); + } + else + { + // Enter GE2D -> + ge2dInit(sizeof(lv_color_t) * 8, fill_area_w, fill_area_h, (void *)dest_buf); + } + + ge2dClip_SetClip(fill_area->x1, fill_area->y1, fill_area->x2, fill_area->y2); + if (sizeof(lv_color_t) == 4) + { + ge2dFill_Solid(fill_area->x1, fill_area->y1, fill_area_w, fill_area_h, color.full); + } + else if (sizeof(lv_color_t) == 2) + { + ge2dFill_Solid_RGB565(fill_area->x1, fill_area->y1, fill_area_w, fill_area_h, color.full); + } + ge2dClip_SetClip(-1, 0, 0, 0); + // -> Leave GE2D } - ge2dClip_SetClip(-1, 0, 0, 0); - // -> Leave GE2D } -void lcd_perf_monitor(struct _lv_disp_drv_t *disp_drv, uint32_t time, uint32_t px) +void nu_perf_monitor(struct _lv_disp_drv_t *disp_drv, uint32_t time, uint32_t px) { - rt_kprintf("Elapsed: %dms, Pixel: %d, Bytes:%d\n", time, px, px * sizeof(lv_color_t)); + rt_kprintf("Elapsed: %dms, Pixel: %d, Bytes:%d, %d%\n", time, px, px * sizeof(lv_color_t), px * 100 / disp_drv->draw_buf->size); } void lv_port_disp_init(void) @@ -73,6 +136,7 @@ void lv_port_disp_init(void) rt_err_t result; void *buf_1 = RT_NULL; void *buf_2 = RT_NULL; + uint32_t u32FBSize; lcd_device = rt_device_find("lcd"); if (lcd_device == 0) @@ -93,9 +157,35 @@ void lv_port_disp_init(void) RT_ASSERT(info.bits_per_pixel == 8 || info.bits_per_pixel == 16 || info.bits_per_pixel == 24 || info.bits_per_pixel == 32); - buf_1 = (void *)info.framebuffer; - buf_2 = (void *)((uint32_t)buf_1 + info.height * info.width * info.bits_per_pixel / 8); - rt_kprintf("LVGL: Use two buffers - buf_1@%08x, buf_2@%08x\n", buf_1, buf_2); + lv_disp_drv_init(&disp_drv); /*Basic initialization*/ + + /*Set the resolution of the display*/ + disp_drv.hor_res = info.width; + disp_drv.ver_res = info.height; + //disp_drv.full_refresh = 1; + disp_drv.direct_mode = 1; + u32FBSize = info.height * info.width * (info.bits_per_pixel / 8); + + if (disp_drv.full_refresh || disp_drv.direct_mode) + { + buf_1 = (void *)info.framebuffer; + buf_2 = (void *)((uint32_t)buf_1 + u32FBSize); + rt_kprintf("LVGL: Two screen-sized buffers(%s) - buf_1@%08x, buf_2@%08x\n", (disp_drv.full_refresh == 1) ? "full_refresh" : "direct_mode", buf_1, buf_2); + + if (disp_drv.direct_mode) + disp_drv.flush_cb = nu_flush_direct; + else + disp_drv.flush_cb = nu_flush_full_refresh; + } + else + { + buf_1 = (void *)(((uint32_t)info.framebuffer) + u32FBSize); + buf_2 = (void *)((uint32_t)buf_1 + u32FBSize); + rt_kprintf("LVGL: Two screen-sized buffers - buf_1@%08x, buf_2@%08x\n", buf_1, buf_2); + rt_device_control(lcd_device, RTGRAPHIC_CTRL_PAN_DISPLAY, info.framebuffer); + + disp_drv.flush_cb = nu_flush; + } /*Initialize `disp_buf` with the buffer(s).*/ lv_disp_draw_buf_init(&disp_buf, buf_1, buf_2, info.width * info.height); @@ -107,24 +197,14 @@ void lv_port_disp_init(void) return; } - lv_disp_drv_init(&disp_drv); /*Basic initialization*/ - - /*Set the resolution of the display*/ - disp_drv.hor_res = info.width; - disp_drv.ver_res = info.height; - disp_drv.full_refresh = 1; - /*Set a display buffer*/ disp_drv.draw_buf = &disp_buf; - /*Write the internal buffer (draw_buf) to the display*/ - disp_drv.flush_cb = lcd_fb_flush; - /*Fill a memory with a color (GPU only)*/ - disp_drv.gpu_fill_cb = ge2d_fill_cb; + disp_drv.gpu_fill_cb = nu_fill_cb; - /* Called after every refresh cycle to tell the rendering and flushing time + the number of flushed pixels */ - //disp_drv.monitor_cb = lcd_perf_monitor; + /*Called after every refresh cycle to tell the rendering and flushing time + the number of flushed pixels*/ + //disp_drv.monitor_cb = nu_perf_monitor; /*Finally register the driver*/ lv_disp_drv_register(&disp_drv); diff --git a/include/rtdef.h b/include/rtdef.h index c22c20beee..b31bd1e3f8 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -1098,6 +1098,8 @@ struct rt_device_blk_sectors #define RTGRAPHIC_CTRL_GET_BRIGHTNESS 7 #define RTGRAPHIC_CTRL_GET_MODE 8 #define RTGRAPHIC_CTRL_GET_STATUS 9 +#define RTGRAPHIC_CTRL_PAN_DISPLAY 10 +#define RTGRAPHIC_CTRL_WAIT_VSYNC 11 /* graphic deice */ enum -- cgit v1.3.1 From d2e6715ddbc03f5e6d0bb3f44e5eb73135a5b258 Mon Sep 17 00:00:00 2001 From: weycen Date: Sun, 26 Dec 2021 00:26:50 +0800 Subject: [kernel] Add __attribute__(...) for rt_kprintf() to let the compiler check the format string parameters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tested in the following environment: 1. Keil uVersion:Arm Compiler v5.06、v6.7、v6.16 2. Atollic TrueSTUDIO for STM32:GNU v6.3.1 3. Code Composer Studio:TI Compiler v20.2.2.LTS、GNU v7.2.1 --- include/rtthread.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/rtthread.h b/include/rtthread.h index d18355c426..8f0f43f7cc 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -570,7 +570,12 @@ void rt_components_board_init(void); #define rt_kprintf(...) #define rt_kputs(str) #else +#if defined(__ARMCC_VERSION) || defined(__GNUC__) || \ + defined(__TI_COMPILER_VERSION__) +int rt_kprintf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); +#else int rt_kprintf(const char *fmt, ...); +#endif void rt_kputs(const char *str); #endif -- cgit v1.3.1 From ead24644f008232f81e0408bfb15e99deff115bb Mon Sep 17 00:00:00 2001 From: weycen Date: Sun, 26 Dec 2021 18:23:31 +0800 Subject: Add support for IAR Compiler --- include/rtthread.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/rtthread.h b/include/rtthread.h index 8f0f43f7cc..1f9d3328c1 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -571,7 +571,7 @@ void rt_components_board_init(void); #define rt_kputs(str) #else #if defined(__ARMCC_VERSION) || defined(__GNUC__) || \ - defined(__TI_COMPILER_VERSION__) + defined(__ICCARM__) || defined(__TI_COMPILER_VERSION__) int rt_kprintf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); #else int rt_kprintf(const char *fmt, ...); -- cgit v1.3.1 From 5187d75af538d9ae268e7d4d31dd412f20d0a63d Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Wed, 29 Dec 2021 14:14:07 -0500 Subject: [armclang] 使用__clang__代替__CLANG_ARM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/Vango_V85xx/drivers/board.h | 2 +- bsp/acm32f0x0-nucleo/drivers/board.c | 4 ++-- bsp/acm32f4xx-nucleo/drivers/board.c | 4 ++-- bsp/apm32/apm32f103xe-minibroard/board/board.h | 2 +- bsp/at32/at32f403a-start/board/board.h | 2 +- bsp/at32/at32f407-start/board/board.h | 2 +- bsp/essemi/es32f0654/drivers/board.h | 2 +- bsp/essemi/es32f365x/drivers/board.h | 2 +- bsp/essemi/es32f369x/drivers/board.h | 2 +- bsp/gd32e230k-start/drivers/board.h | 2 +- bsp/hk32/hk32f030c8-mini/board/board.h | 2 +- bsp/lpc55sxx/Libraries/template/lpc55s6xxxx/applications/main.c | 2 +- bsp/lpc55sxx/Libraries/template/lpc55s6xxxx/board/board.h | 2 +- bsp/lpc55sxx/lpc55s69_nxp_evk/applications/main.c | 2 +- bsp/lpc55sxx/lpc55s69_nxp_evk/board/board.h | 2 +- bsp/maxim/MAX32660_EVSYS/board/board.h | 2 +- bsp/mm32l07x/drivers/board.h | 2 +- bsp/n32g452xx/n32g452xx-mini-system/board/board.h | 2 +- bsp/nrf5x/libraries/templates/nrfx/board/board.h | 2 +- bsp/nrf5x/nrf51822/board/board.h | 2 +- bsp/nrf5x/nrf52832/board/board.h | 2 +- bsp/nrf5x/nrf52833/board/board.h | 2 +- bsp/nrf5x/nrf52840/board/board.h | 2 +- bsp/nuvoton/numaker-iot-m487/board/board.h | 2 +- bsp/nuvoton/numaker-m032ki/board/board.h | 2 +- bsp/nuvoton/numaker-m2354/board/board.h | 2 +- bsp/nuvoton/numaker-pfm-m487/board/board.h | 2 +- bsp/samd21/applications/startup.c | 4 ++-- bsp/stm32/libraries/templates/stm32f0xx/board/board.h | 2 +- bsp/stm32/libraries/templates/stm32f10x/board/board.h | 2 +- bsp/stm32/libraries/templates/stm32f2xx/board/board.h | 2 +- bsp/stm32/libraries/templates/stm32f3xx/board/board.h | 2 +- bsp/stm32/libraries/templates/stm32f4xx/board/board.h | 2 +- bsp/stm32/libraries/templates/stm32f7xx/board/board.h | 2 +- bsp/stm32/libraries/templates/stm32h7xx/board/board.h | 2 +- bsp/stm32/libraries/templates/stm32l1xx/board/board.h | 2 +- bsp/stm32/libraries/templates/stm32l4xx/board/board.h | 2 +- bsp/stm32/libraries/templates/stm32l5xx/board/board.h | 2 +- bsp/stm32/libraries/templates/stm32mp1xx/board/board.h | 2 +- bsp/stm32/libraries/templates/stm32wbxx/board/board.h | 2 +- bsp/stm32/stm32f072-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32f091-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32f103-atk-nano/board/board.h | 2 +- bsp/stm32/stm32f103-atk-warshipv3/board/board.h | 2 +- bsp/stm32/stm32f103-blue-pill/board/board.h | 2 +- bsp/stm32/stm32f103-dofly-M3S/board/board.h | 2 +- bsp/stm32/stm32f103-dofly-lyc8/board/board.h | 2 +- bsp/stm32/stm32f103-fire-arbitrary/board/board.h | 2 +- bsp/stm32/stm32f103-gizwits-gokitv21/board/board.h | 2 +- bsp/stm32/stm32f103-hw100k-ibox/board/board.h | 2 +- bsp/stm32/stm32f103-onenet-nbiot/board/board.h | 2 +- bsp/stm32/stm32f103-yf-ufun/board/board.h | 2 +- bsp/stm32/stm32f107-uc-eval/board/board.h | 2 +- bsp/stm32/stm32f207-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32f302-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32f401-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32f405-smdz-breadfruit/board/board.h | 2 +- bsp/stm32/stm32f407-armfly-v5/board/board.h | 2 +- bsp/stm32/stm32f407-atk-explorer/applications/lvgl/lv_port_disp.c | 2 +- bsp/stm32/stm32f407-atk-explorer/board/board.h | 2 +- bsp/stm32/stm32f407-robomaster-c/board/board.h | 2 +- bsp/stm32/stm32f407-st-discovery/board/board.h | 2 +- bsp/stm32/stm32f410-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32f411-atk-nano/board/board.h | 2 +- bsp/stm32/stm32f411-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32f411-weact-MiniF4/board/board.h | 2 +- bsp/stm32/stm32f412-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32f413-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32f427-robomaster-a/board/board.h | 2 +- bsp/stm32/stm32f429-armfly-v6/board/board.h | 2 +- bsp/stm32/stm32f429-atk-apollo/board/board.h | 2 +- bsp/stm32/stm32f429-fire-challenger/board/board.h | 2 +- bsp/stm32/stm32f429-st-disco/board/board.h | 2 +- bsp/stm32/stm32f446-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32f469-st-disco/board/board.h | 2 +- bsp/stm32/stm32f746-st-disco/board/board.h | 2 +- bsp/stm32/stm32f746-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32f767-atk-apollo/board/board.h | 2 +- bsp/stm32/stm32f767-fire-challenger-v1/board/board.h | 2 +- bsp/stm32/stm32f767-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32f769-st-disco/board/board.h | 2 +- bsp/stm32/stm32g070-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32g071-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32g431-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32g474-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32h743-armfly-V7/board/board.h | 2 +- bsp/stm32/stm32h743-atk-apollo/board/board.h | 2 +- bsp/stm32/stm32h743-openmv-h7plus/board/board.h | 2 +- bsp/stm32/stm32h743-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32h747-st-discovery/board/board.h | 2 +- bsp/stm32/stm32h750-armfly-h7-tool/board/board.h | 2 +- bsp/stm32/stm32h750-artpi-h750/board/board.h | 2 +- bsp/stm32/stm32l010-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32l053-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32l433-ali-startkit/board/board.h | 2 +- bsp/stm32/stm32l452-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32l475-atk-pandora/board/board.h | 2 +- bsp/stm32/stm32l496-ali-developer/board/board.h | 2 +- bsp/stm32/stm32l496-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32l4r9-st-sensortile-box/board/board.h | 2 +- bsp/stm32/stm32l552-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32mp157a-st-discovery/board/board.h | 2 +- bsp/stm32/stm32mp157a-st-discovery/board/ports/audio/drv_mic.c | 2 +- bsp/stm32/stm32mp157a-st-discovery/board/ports/audio/drv_sound.c | 2 +- bsp/stm32/stm32mp157a-st-discovery/board/ports/drv_eth.c | 2 +- bsp/stm32/stm32mp157a-st-discovery/board/ports/drv_sdio.c | 2 +- bsp/stm32/stm32mp157a-st-ev1/board/board.h | 2 +- bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_dfsdm.c | 6 +++--- bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_emmc.c | 2 +- bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_ov5640.c | 4 ++-- bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_sdcard.c | 2 +- bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_sound.c | 2 +- bsp/stm32/stm32mp157a-st-ev1/board/ports/eth/drv_eth.c | 2 +- bsp/stm32/stm32u575-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32wb55-st-nucleo/board/board.h | 2 +- bsp/swm320-lq100/drivers/board.h | 2 +- bsp/swm320/drivers/board.h | 2 +- bsp/tm4c123bsp/board/board.h | 2 +- bsp/wch/arm/ch32f103c8-core/board/board.h | 2 +- bsp/yichip/yc3121-pos/drivers/board.h | 2 +- components/cplusplus/cxx_crt_init.c | 4 ++-- components/libc/compilers/armlibc/syscalls.c | 4 ++-- components/utilities/utest/utest.c | 2 +- components/utilities/var_export/var_export.c | 6 +++--- include/rtdef.h | 4 ---- libcpu/arm/cortex-m3/cpuport.c | 2 +- libcpu/arm/cortex-m33/cpuport.c | 4 ++-- libcpu/arm/cortex-m33/trustzone.c | 2 +- libcpu/arm/cortex-m4/cpuport.c | 4 ++-- libcpu/arm/cortex-m7/cpuport.c | 4 ++-- libcpu/sim/win32/startup.c | 4 ++-- 131 files changed, 144 insertions(+), 148 deletions(-) (limited to 'include') diff --git a/bsp/Vango_V85xx/drivers/board.h b/bsp/Vango_V85xx/drivers/board.h index e8e312d110..837f195b9e 100644 --- a/bsp/Vango_V85xx/drivers/board.h +++ b/bsp/Vango_V85xx/drivers/board.h @@ -21,7 +21,7 @@ #define V85XX_SRAM_SIZE 32 #define V85XX_SRAM_END (0x20000000 + V85XX_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/acm32f0x0-nucleo/drivers/board.c b/bsp/acm32f0x0-nucleo/drivers/board.c index 28e8b77322..841560184e 100644 --- a/bsp/acm32f0x0-nucleo/drivers/board.c +++ b/bsp/acm32f0x0-nucleo/drivers/board.c @@ -18,7 +18,7 @@ extern int rt_application_init(void); -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #elif __ICCARM__ #pragma section="HEAP" @@ -58,7 +58,7 @@ void rt_hw_board_init(void) rt_console_set_device(RT_CONSOLE_DEVICE_NAME); #ifdef RT_USING_HEAP -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) rt_system_heap_init((void *)&Image$$RW_IRAM1$$ZI$$Limit, (void *)SOC_SRAM_END_ADDR); #elif __ICCARM__ rt_system_heap_init(__segment_end("HEAP"), (void *)SOC_SRAM_END_ADDR); diff --git a/bsp/acm32f4xx-nucleo/drivers/board.c b/bsp/acm32f4xx-nucleo/drivers/board.c index 050db7656b..202a0371da 100644 --- a/bsp/acm32f4xx-nucleo/drivers/board.c +++ b/bsp/acm32f4xx-nucleo/drivers/board.c @@ -17,7 +17,7 @@ extern int rt_application_init(void); -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #elif __ICCARM__ #pragma section="HEAP" @@ -57,7 +57,7 @@ void rt_hw_board_init(void) rt_console_set_device(RT_CONSOLE_DEVICE_NAME); #ifdef RT_USING_HEAP -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) rt_system_heap_init((void *)&Image$$RW_IRAM1$$ZI$$Limit, (void *)SOC_SRAM_END_ADDR); #elif __ICCARM__ rt_system_heap_init(__segment_end("HEAP"), (void *)SOC_SRAM_END_ADDR); diff --git a/bsp/apm32/apm32f103xe-minibroard/board/board.h b/bsp/apm32/apm32f103xe-minibroard/board/board.h index da63a21995..b2f4773b26 100644 --- a/bsp/apm32/apm32f103xe-minibroard/board/board.h +++ b/bsp/apm32/apm32f103xe-minibroard/board/board.h @@ -36,7 +36,7 @@ extern "C" { #define APM32_SRAM_SIZE 128 #define APM32_SRAM_END (0x20000000 + APM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/at32/at32f403a-start/board/board.h b/bsp/at32/at32f403a-start/board/board.h index 1f2a4f3f3c..762b087a7c 100644 --- a/bsp/at32/at32f403a-start/board/board.h +++ b/bsp/at32/at32f403a-start/board/board.h @@ -29,7 +29,7 @@ extern "C" { #define AT32_SRAM_SIZE 96 #define AT32_SRAM_END (0x20000000 + AT32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/at32/at32f407-start/board/board.h b/bsp/at32/at32f407-start/board/board.h index 1f2a4f3f3c..762b087a7c 100644 --- a/bsp/at32/at32f407-start/board/board.h +++ b/bsp/at32/at32f407-start/board/board.h @@ -29,7 +29,7 @@ extern "C" { #define AT32_SRAM_SIZE 96 #define AT32_SRAM_END (0x20000000 + AT32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/essemi/es32f0654/drivers/board.h b/bsp/essemi/es32f0654/drivers/board.h index 73ca6c11de..c187b82b24 100644 --- a/bsp/essemi/es32f0654/drivers/board.h +++ b/bsp/essemi/es32f0654/drivers/board.h @@ -31,7 +31,7 @@ #define ES32F0_SRAM_SIZE 0x8000 #define ES32F0_SRAM_END (0x20000000 + ES32F0_SRAM_SIZE) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/essemi/es32f365x/drivers/board.h b/bsp/essemi/es32f365x/drivers/board.h index 796121513a..34ee8b1c38 100644 --- a/bsp/essemi/es32f365x/drivers/board.h +++ b/bsp/essemi/es32f365x/drivers/board.h @@ -30,7 +30,7 @@ #define ES32F3_SRAM_SIZE 0x10000 #define ES32F3_SRAM_END (0x20000000 + ES32F3_SRAM_SIZE) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/essemi/es32f369x/drivers/board.h b/bsp/essemi/es32f369x/drivers/board.h index 971216e9a9..871ab7436e 100644 --- a/bsp/essemi/es32f369x/drivers/board.h +++ b/bsp/essemi/es32f369x/drivers/board.h @@ -31,7 +31,7 @@ #define ES32F3_SRAM_SIZE 0x18000 #define ES32F3_SRAM_END (0x20000000 + ES32F3_SRAM_SIZE) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/gd32e230k-start/drivers/board.h b/bsp/gd32e230k-start/drivers/board.h index 7d491aeaa8..c76f570768 100644 --- a/bsp/gd32e230k-start/drivers/board.h +++ b/bsp/gd32e230k-start/drivers/board.h @@ -25,7 +25,7 @@ extern char __ICFEDIT_region_RAM_end__; #define GD32_SRAM_END (0x20000000 + GD32_SRAM_SIZE * 1024) #endif -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/hk32/hk32f030c8-mini/board/board.h b/bsp/hk32/hk32f030c8-mini/board/board.h index 6e6d0d4f5c..b0b3752ee1 100644 --- a/bsp/hk32/hk32f030c8-mini/board/board.h +++ b/bsp/hk32/hk32f030c8-mini/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define HK32_SRAM_SIZE 10 #define HK32_SRAM_END (0x20000000 + HK32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/lpc55sxx/Libraries/template/lpc55s6xxxx/applications/main.c b/bsp/lpc55sxx/Libraries/template/lpc55s6xxxx/applications/main.c index ef4393ba39..d9a8b55a1b 100644 --- a/bsp/lpc55sxx/Libraries/template/lpc55s6xxxx/applications/main.c +++ b/bsp/lpc55sxx/Libraries/template/lpc55s6xxxx/applications/main.c @@ -20,7 +20,7 @@ int main(void) { #if defined(__CC_ARM) rt_kprintf("using armcc, version: %d\n", __ARMCC_VERSION); -#elif defined(__CLANG_ARM) +#elif defined(__clang__) rt_kprintf("using armclang, version: %d\n", __ARMCC_VERSION); #elif defined(__ICCARM__) rt_kprintf("using iccarm, version: %d\n", __VER__); diff --git a/bsp/lpc55sxx/Libraries/template/lpc55s6xxxx/board/board.h b/bsp/lpc55sxx/Libraries/template/lpc55s6xxxx/board/board.h index 1899798c13..20c46767d1 100644 --- a/bsp/lpc55sxx/Libraries/template/lpc55s6xxxx/board/board.h +++ b/bsp/lpc55sxx/Libraries/template/lpc55s6xxxx/board/board.h @@ -29,7 +29,7 @@ // // -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$ARM_LIB_HEAP$$ZI$$Base; #define HEAP_BEGIN ((void *)&Image$$ARM_LIB_HEAP$$ZI$$Base) #elif defined(__ICCARM__) diff --git a/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/main.c b/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/main.c index 7a368dcd54..3dd5d599dc 100644 --- a/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/main.c +++ b/bsp/lpc55sxx/lpc55s69_nxp_evk/applications/main.c @@ -24,7 +24,7 @@ int main(void) { #if defined(__CC_ARM) rt_kprintf("using armcc, version: %d\n", __ARMCC_VERSION); -#elif defined(__CLANG_ARM) +#elif defined(__clang__) rt_kprintf("using armclang, version: %d\n", __ARMCC_VERSION); #elif defined(__ICCARM__) rt_kprintf("using iccarm, version: %d\n", __VER__); diff --git a/bsp/lpc55sxx/lpc55s69_nxp_evk/board/board.h b/bsp/lpc55sxx/lpc55s69_nxp_evk/board/board.h index 7500557fcb..bdda20fbb4 100644 --- a/bsp/lpc55sxx/lpc55s69_nxp_evk/board/board.h +++ b/bsp/lpc55sxx/lpc55s69_nxp_evk/board/board.h @@ -29,7 +29,7 @@ // // -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$ARM_LIB_HEAP$$ZI$$Base; extern int Image$$ARM_LIB_STACK$$ZI$$Base; #define HEAP_BEGIN ((void *)&Image$$ARM_LIB_HEAP$$ZI$$Base) diff --git a/bsp/maxim/MAX32660_EVSYS/board/board.h b/bsp/maxim/MAX32660_EVSYS/board/board.h index 490e91a95f..093bb86ad8 100644 --- a/bsp/maxim/MAX32660_EVSYS/board/board.h +++ b/bsp/maxim/MAX32660_EVSYS/board/board.h @@ -26,7 +26,7 @@ #define MCU_SRAM_START (0x20000000) #define MCU_SRAM_END (MCU_SRAM_START + MCU_SRAM_SIZE_KB * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/mm32l07x/drivers/board.h b/bsp/mm32l07x/drivers/board.h index cfc02d288e..fc2da93b0e 100644 --- a/bsp/mm32l07x/drivers/board.h +++ b/bsp/mm32l07x/drivers/board.h @@ -16,7 +16,7 @@ #define SRAM_SIZE 0x2000 #define SRAM_END (SRAM_BASE + SRAM_SIZE) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/n32g452xx/n32g452xx-mini-system/board/board.h b/bsp/n32g452xx/n32g452xx-mini-system/board/board.h index 71f5ca48a0..0a3b0fa661 100644 --- a/bsp/n32g452xx/n32g452xx-mini-system/board/board.h +++ b/bsp/n32g452xx/n32g452xx-mini-system/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define N32_SRAM_SIZE (80) #define N32_SRAM_END (0x20000000 + N32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/nrf5x/libraries/templates/nrfx/board/board.h b/bsp/nrf5x/libraries/templates/nrfx/board/board.h index 52e812fac6..26543f7f6f 100644 --- a/bsp/nrf5x/libraries/templates/nrfx/board/board.h +++ b/bsp/nrf5x/libraries/templates/nrfx/board/board.h @@ -20,7 +20,7 @@ #define MCU_SRAM_SIZE MCU_SRAM_SIZE_KB*1024 #define MCU_SRAM_END_ADDRESS (MCU_SRAM_START_ADDRESS + MCU_SRAM_SIZE) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/nrf5x/nrf51822/board/board.h b/bsp/nrf5x/nrf51822/board/board.h index a3ccadfa36..f2bbf90e79 100644 --- a/bsp/nrf5x/nrf51822/board/board.h +++ b/bsp/nrf5x/nrf51822/board/board.h @@ -10,7 +10,7 @@ #define MCU_SRAM_SIZE MCU_SRAM_SIZE_KB*1024 #define MCU_SRAM_END_ADDRESS (MCU_SRAM_START_ADDRESS + MCU_SRAM_SIZE) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/nrf5x/nrf52832/board/board.h b/bsp/nrf5x/nrf52832/board/board.h index 32acd6b56c..2b556fb6e6 100644 --- a/bsp/nrf5x/nrf52832/board/board.h +++ b/bsp/nrf5x/nrf52832/board/board.h @@ -10,7 +10,7 @@ #define MCU_SRAM_SIZE MCU_SRAM_SIZE_KB*1024 #define MCU_SRAM_END_ADDRESS (MCU_SRAM_START_ADDRESS + MCU_SRAM_SIZE) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/nrf5x/nrf52833/board/board.h b/bsp/nrf5x/nrf52833/board/board.h index 52e812fac6..26543f7f6f 100644 --- a/bsp/nrf5x/nrf52833/board/board.h +++ b/bsp/nrf5x/nrf52833/board/board.h @@ -20,7 +20,7 @@ #define MCU_SRAM_SIZE MCU_SRAM_SIZE_KB*1024 #define MCU_SRAM_END_ADDRESS (MCU_SRAM_START_ADDRESS + MCU_SRAM_SIZE) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/nrf5x/nrf52840/board/board.h b/bsp/nrf5x/nrf52840/board/board.h index edfb0b635a..533a45156e 100644 --- a/bsp/nrf5x/nrf52840/board/board.h +++ b/bsp/nrf5x/nrf52840/board/board.h @@ -20,7 +20,7 @@ #define MCU_SRAM_SIZE MCU_SRAM_SIZE_KB*1024 #define MCU_SRAM_END_ADDRESS (MCU_SRAM_START_ADDRESS + MCU_SRAM_SIZE) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/nuvoton/numaker-iot-m487/board/board.h b/bsp/nuvoton/numaker-iot-m487/board/board.h index cd45f65e76..60515faf35 100644 --- a/bsp/nuvoton/numaker-iot-m487/board/board.h +++ b/bsp/nuvoton/numaker-iot-m487/board/board.h @@ -17,7 +17,7 @@ #define SRAM_SIZE (160) #define SRAM_END (0x20000000 + SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/nuvoton/numaker-m032ki/board/board.h b/bsp/nuvoton/numaker-m032ki/board/board.h index acdd559291..bc6fc79f82 100644 --- a/bsp/nuvoton/numaker-m032ki/board/board.h +++ b/bsp/nuvoton/numaker-m032ki/board/board.h @@ -17,7 +17,7 @@ #define SRAM_SIZE (96) #define SRAM_END (0x20000000 + SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/nuvoton/numaker-m2354/board/board.h b/bsp/nuvoton/numaker-m2354/board/board.h index e783166fef..c28c4ee36a 100644 --- a/bsp/nuvoton/numaker-m2354/board/board.h +++ b/bsp/nuvoton/numaker-m2354/board/board.h @@ -17,7 +17,7 @@ #define SRAM_SIZE (256) #define SRAM_END (0x20000000 + SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/nuvoton/numaker-pfm-m487/board/board.h b/bsp/nuvoton/numaker-pfm-m487/board/board.h index cd45f65e76..60515faf35 100644 --- a/bsp/nuvoton/numaker-pfm-m487/board/board.h +++ b/bsp/nuvoton/numaker-pfm-m487/board/board.h @@ -17,7 +17,7 @@ #define SRAM_SIZE (160) #define SRAM_END (0x20000000 + SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/samd21/applications/startup.c b/bsp/samd21/applications/startup.c index ecbe617d2e..0a689a9e74 100644 --- a/bsp/samd21/applications/startup.c +++ b/bsp/samd21/applications/startup.c @@ -29,7 +29,7 @@ extern void finsh_system_init(void); extern void finsh_set_device(const char* device); #endif -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #elif __ICCARM__ #pragma section="HEAP" @@ -72,7 +72,7 @@ void rtthread_startup(void) rt_system_timer_init(); #ifdef RT_USING_HEAP - #if defined(__CC_ARM) || defined(__CLANG_ARM) + #if defined(__ARMCC_VERSION) rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)CHIP_SRAM_END); #elif __ICCARM__ rt_system_heap_init(__segment_end("HEAP"), (void*)CHIP_SRAM_END); diff --git a/bsp/stm32/libraries/templates/stm32f0xx/board/board.h b/bsp/stm32/libraries/templates/stm32f0xx/board/board.h index fbc2af5ebe..557856de37 100644 --- a/bsp/stm32/libraries/templates/stm32f0xx/board/board.h +++ b/bsp/stm32/libraries/templates/stm32f0xx/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_SRAM_SIZE 32 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/libraries/templates/stm32f10x/board/board.h b/bsp/stm32/libraries/templates/stm32f10x/board/board.h index fc435ee029..a6aa7d6654 100644 --- a/bsp/stm32/libraries/templates/stm32f10x/board/board.h +++ b/bsp/stm32/libraries/templates/stm32f10x/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_SRAM_SIZE 20 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/libraries/templates/stm32f2xx/board/board.h b/bsp/stm32/libraries/templates/stm32f2xx/board/board.h index b93a301f4e..6d0c5e53b6 100644 --- a/bsp/stm32/libraries/templates/stm32f2xx/board/board.h +++ b/bsp/stm32/libraries/templates/stm32f2xx/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_SRAM_SIZE 128 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/libraries/templates/stm32f3xx/board/board.h b/bsp/stm32/libraries/templates/stm32f3xx/board/board.h index 1de41e4a63..de61eb7514 100644 --- a/bsp/stm32/libraries/templates/stm32f3xx/board/board.h +++ b/bsp/stm32/libraries/templates/stm32f3xx/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE 16 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/libraries/templates/stm32f4xx/board/board.h b/bsp/stm32/libraries/templates/stm32f4xx/board/board.h index 514155b823..50bf01a1ca 100644 --- a/bsp/stm32/libraries/templates/stm32f4xx/board/board.h +++ b/bsp/stm32/libraries/templates/stm32f4xx/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE 128 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/libraries/templates/stm32f7xx/board/board.h b/bsp/stm32/libraries/templates/stm32f7xx/board/board.h index 2951235675..a02fbca511 100644 --- a/bsp/stm32/libraries/templates/stm32f7xx/board/board.h +++ b/bsp/stm32/libraries/templates/stm32f7xx/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE (512) #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/libraries/templates/stm32h7xx/board/board.h b/bsp/stm32/libraries/templates/stm32h7xx/board/board.h index 72d84ff29d..9c856893de 100644 --- a/bsp/stm32/libraries/templates/stm32h7xx/board/board.h +++ b/bsp/stm32/libraries/templates/stm32h7xx/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE (512) #define STM32_SRAM_END (0x24000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/libraries/templates/stm32l1xx/board/board.h b/bsp/stm32/libraries/templates/stm32l1xx/board/board.h index f6cfb3522b..01696fe3c5 100644 --- a/bsp/stm32/libraries/templates/stm32l1xx/board/board.h +++ b/bsp/stm32/libraries/templates/stm32l1xx/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE 16 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/libraries/templates/stm32l4xx/board/board.h b/bsp/stm32/libraries/templates/stm32l4xx/board/board.h index b5120ac476..a2555c2b6f 100644 --- a/bsp/stm32/libraries/templates/stm32l4xx/board/board.h +++ b/bsp/stm32/libraries/templates/stm32l4xx/board/board.h @@ -29,7 +29,7 @@ extern "C" { #define STM32_SRAM1_START (0x20000000) #define STM32_SRAM1_END (STM32_SRAM1_START + STM32_SRAM1_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/libraries/templates/stm32l5xx/board/board.h b/bsp/stm32/libraries/templates/stm32l5xx/board/board.h index 049dfd05fb..479a4262fb 100644 --- a/bsp/stm32/libraries/templates/stm32l5xx/board/board.h +++ b/bsp/stm32/libraries/templates/stm32l5xx/board/board.h @@ -29,7 +29,7 @@ extern "C" { #define STM32_SRAM1_START (0x20000000) #define STM32_SRAM1_END (STM32_SRAM1_START + STM32_SRAM1_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/libraries/templates/stm32mp1xx/board/board.h b/bsp/stm32/libraries/templates/stm32mp1xx/board/board.h index b23b83ee30..ecf4c1a88f 100644 --- a/bsp/stm32/libraries/templates/stm32mp1xx/board/board.h +++ b/bsp/stm32/libraries/templates/stm32mp1xx/board/board.h @@ -29,7 +29,7 @@ extern "C" { #define STM32_SRAM_SIZE (128) #define STM32_SRAM_END ((uint32_t)0x10040000 + (STM32_SRAM_SIZE * 1024)) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/libraries/templates/stm32wbxx/board/board.h b/bsp/stm32/libraries/templates/stm32wbxx/board/board.h index d77bf172ba..6585a352c7 100644 --- a/bsp/stm32/libraries/templates/stm32wbxx/board/board.h +++ b/bsp/stm32/libraries/templates/stm32wbxx/board/board.h @@ -29,7 +29,7 @@ extern "C" { #define STM32_SRAM1_START (0x20000000) #define STM32_SRAM1_END (STM32_SRAM1_START + STM32_SRAM1_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f072-st-nucleo/board/board.h b/bsp/stm32/stm32f072-st-nucleo/board/board.h index 51a9f80edd..4dc58c3c92 100644 --- a/bsp/stm32/stm32f072-st-nucleo/board/board.h +++ b/bsp/stm32/stm32f072-st-nucleo/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_SRAM_SIZE 16 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f091-st-nucleo/board/board.h b/bsp/stm32/stm32f091-st-nucleo/board/board.h index a9ba91377d..efd152dc0d 100644 --- a/bsp/stm32/stm32f091-st-nucleo/board/board.h +++ b/bsp/stm32/stm32f091-st-nucleo/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_SRAM_SIZE 32 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f103-atk-nano/board/board.h b/bsp/stm32/stm32f103-atk-nano/board/board.h index 498459073e..05d7bdaf2d 100644 --- a/bsp/stm32/stm32f103-atk-nano/board/board.h +++ b/bsp/stm32/stm32f103-atk-nano/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE 20 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f103-atk-warshipv3/board/board.h b/bsp/stm32/stm32f103-atk-warshipv3/board/board.h index 80c80984bf..023339a177 100644 --- a/bsp/stm32/stm32f103-atk-warshipv3/board/board.h +++ b/bsp/stm32/stm32f103-atk-warshipv3/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_SRAM_SIZE 64 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f103-blue-pill/board/board.h b/bsp/stm32/stm32f103-blue-pill/board/board.h index 1be364929a..aaa6eeafc0 100644 --- a/bsp/stm32/stm32f103-blue-pill/board/board.h +++ b/bsp/stm32/stm32f103-blue-pill/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_SRAM_SIZE 20 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f103-dofly-M3S/board/board.h b/bsp/stm32/stm32f103-dofly-M3S/board/board.h index 8662bff0f5..8403f451d4 100644 --- a/bsp/stm32/stm32f103-dofly-M3S/board/board.h +++ b/bsp/stm32/stm32f103-dofly-M3S/board/board.h @@ -29,7 +29,7 @@ extern "C" { #define STM32_SRAM_SIZE 64 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f103-dofly-lyc8/board/board.h b/bsp/stm32/stm32f103-dofly-lyc8/board/board.h index 8d8cc4643a..3d813a0af0 100644 --- a/bsp/stm32/stm32f103-dofly-lyc8/board/board.h +++ b/bsp/stm32/stm32f103-dofly-lyc8/board/board.h @@ -23,7 +23,7 @@ #define STM32_SRAM_SIZE 20 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f103-fire-arbitrary/board/board.h b/bsp/stm32/stm32f103-fire-arbitrary/board/board.h index 7aa3c0f703..3cc20b82e4 100644 --- a/bsp/stm32/stm32f103-fire-arbitrary/board/board.h +++ b/bsp/stm32/stm32f103-fire-arbitrary/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_FLASH_SIZE (512 * 1024) #define STM32_FLASH_END_ADDRESS ((uint32_t)(STM32_FLASH_START_ADRESS + STM32_FLASH_SIZE)) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f103-gizwits-gokitv21/board/board.h b/bsp/stm32/stm32f103-gizwits-gokitv21/board/board.h index cdb13091cd..6c852d9609 100644 --- a/bsp/stm32/stm32f103-gizwits-gokitv21/board/board.h +++ b/bsp/stm32/stm32f103-gizwits-gokitv21/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_SRAM_SIZE 20 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f103-hw100k-ibox/board/board.h b/bsp/stm32/stm32f103-hw100k-ibox/board/board.h index 239f0afdd6..3dfff3bdb0 100644 --- a/bsp/stm32/stm32f103-hw100k-ibox/board/board.h +++ b/bsp/stm32/stm32f103-hw100k-ibox/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_SRAM_SIZE 64 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f103-onenet-nbiot/board/board.h b/bsp/stm32/stm32f103-onenet-nbiot/board/board.h index 162925a4f3..2e5f93a0bb 100644 --- a/bsp/stm32/stm32f103-onenet-nbiot/board/board.h +++ b/bsp/stm32/stm32f103-onenet-nbiot/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE 64 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f103-yf-ufun/board/board.h b/bsp/stm32/stm32f103-yf-ufun/board/board.h index 738f37080a..fa0ff3fed2 100644 --- a/bsp/stm32/stm32f103-yf-ufun/board/board.h +++ b/bsp/stm32/stm32f103-yf-ufun/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_SRAM_SIZE 48 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f107-uc-eval/board/board.h b/bsp/stm32/stm32f107-uc-eval/board/board.h index 44a96208c6..ce1681ba28 100644 --- a/bsp/stm32/stm32f107-uc-eval/board/board.h +++ b/bsp/stm32/stm32f107-uc-eval/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_SRAM_SIZE 64 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f207-st-nucleo/board/board.h b/bsp/stm32/stm32f207-st-nucleo/board/board.h index 77143ecb0e..b7b40bb799 100644 --- a/bsp/stm32/stm32f207-st-nucleo/board/board.h +++ b/bsp/stm32/stm32f207-st-nucleo/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_SRAM_SIZE 128 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f302-st-nucleo/board/board.h b/bsp/stm32/stm32f302-st-nucleo/board/board.h index 1de41e4a63..de61eb7514 100644 --- a/bsp/stm32/stm32f302-st-nucleo/board/board.h +++ b/bsp/stm32/stm32f302-st-nucleo/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE 16 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f401-st-nucleo/board/board.h b/bsp/stm32/stm32f401-st-nucleo/board/board.h index 82647a83a4..93a2407c87 100644 --- a/bsp/stm32/stm32f401-st-nucleo/board/board.h +++ b/bsp/stm32/stm32f401-st-nucleo/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE 96 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f405-smdz-breadfruit/board/board.h b/bsp/stm32/stm32f405-smdz-breadfruit/board/board.h index 844f5e35e6..64d30cc5b7 100644 --- a/bsp/stm32/stm32f405-smdz-breadfruit/board/board.h +++ b/bsp/stm32/stm32f405-smdz-breadfruit/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE (128) #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f407-armfly-v5/board/board.h b/bsp/stm32/stm32f407-armfly-v5/board/board.h index 68016d18bd..00108ee123 100644 --- a/bsp/stm32/stm32f407-armfly-v5/board/board.h +++ b/bsp/stm32/stm32f407-armfly-v5/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE 128 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f407-atk-explorer/applications/lvgl/lv_port_disp.c b/bsp/stm32/stm32f407-atk-explorer/applications/lvgl/lv_port_disp.c index fb38b870ec..30da608bdc 100644 --- a/bsp/stm32/stm32f407-atk-explorer/applications/lvgl/lv_port_disp.c +++ b/bsp/stm32/stm32f407-atk-explorer/applications/lvgl/lv_port_disp.c @@ -26,7 +26,7 @@ static lv_disp_drv_t disp_drv; lv_color_t buf_1[LCD_H * LCD_W]; #elif defined ( __CC_ARM ) /* MDK ARM Compiler */ __attribute__((at(0x68000000))) lv_color_t buf_1[LCD_H * LCD_W]; -#elif defined ( __CLANG_ARM ) /* MDK ARM Compiler v6 */ +#elif defined ( __clang__ ) /* MDK ARM Compiler v6 */ __attribute__((section(".ARM.__at_0x68000000"))) lv_color_t buf_1[LCD_H * LCD_W]; #elif defined ( __GNUC__ ) /* GNU Compiler */ lv_color_t buf_1[LCD_H * LCD_W] __attribute__((section(".MCUlcdgrambysram"))); diff --git a/bsp/stm32/stm32f407-atk-explorer/board/board.h b/bsp/stm32/stm32f407-atk-explorer/board/board.h index 6d80e38f78..b88f85a064 100644 --- a/bsp/stm32/stm32f407-atk-explorer/board/board.h +++ b/bsp/stm32/stm32f407-atk-explorer/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_FLASH_SIZE (1024 * 1024) #define STM32_FLASH_END_ADDRESS ((uint32_t)(STM32_FLASH_START_ADRESS + STM32_FLASH_SIZE)) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f407-robomaster-c/board/board.h b/bsp/stm32/stm32f407-robomaster-c/board/board.h index 25e4852c4c..92b9520169 100644 --- a/bsp/stm32/stm32f407-robomaster-c/board/board.h +++ b/bsp/stm32/stm32f407-robomaster-c/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_SRAM_SIZE 128 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f407-st-discovery/board/board.h b/bsp/stm32/stm32f407-st-discovery/board/board.h index 539e3abf45..ca3b4f8b24 100644 --- a/bsp/stm32/stm32f407-st-discovery/board/board.h +++ b/bsp/stm32/stm32f407-st-discovery/board/board.h @@ -23,7 +23,7 @@ extern "C" { #define STM32_SRAM_SIZE (128) #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f410-st-nucleo/board/board.h b/bsp/stm32/stm32f410-st-nucleo/board/board.h index 72bd8a017c..122ee1b524 100644 --- a/bsp/stm32/stm32f410-st-nucleo/board/board.h +++ b/bsp/stm32/stm32f410-st-nucleo/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE 32 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f411-atk-nano/board/board.h b/bsp/stm32/stm32f411-atk-nano/board/board.h index 2cbe75f5d9..f301f3f527 100644 --- a/bsp/stm32/stm32f411-atk-nano/board/board.h +++ b/bsp/stm32/stm32f411-atk-nano/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE 128 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f411-st-nucleo/board/board.h b/bsp/stm32/stm32f411-st-nucleo/board/board.h index 062038ffdb..25b839b380 100644 --- a/bsp/stm32/stm32f411-st-nucleo/board/board.h +++ b/bsp/stm32/stm32f411-st-nucleo/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE 128 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f411-weact-MiniF4/board/board.h b/bsp/stm32/stm32f411-weact-MiniF4/board/board.h index 062038ffdb..25b839b380 100644 --- a/bsp/stm32/stm32f411-weact-MiniF4/board/board.h +++ b/bsp/stm32/stm32f411-weact-MiniF4/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE 128 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f412-st-nucleo/board/board.h b/bsp/stm32/stm32f412-st-nucleo/board/board.h index 5c463d04e8..8d1465a1c9 100644 --- a/bsp/stm32/stm32f412-st-nucleo/board/board.h +++ b/bsp/stm32/stm32f412-st-nucleo/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE 256 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f413-st-nucleo/board/board.h b/bsp/stm32/stm32f413-st-nucleo/board/board.h index 634003f596..e98990ce75 100644 --- a/bsp/stm32/stm32f413-st-nucleo/board/board.h +++ b/bsp/stm32/stm32f413-st-nucleo/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE 320 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f427-robomaster-a/board/board.h b/bsp/stm32/stm32f427-robomaster-a/board/board.h index a0ea5ca4bd..0e3a162bae 100644 --- a/bsp/stm32/stm32f427-robomaster-a/board/board.h +++ b/bsp/stm32/stm32f427-robomaster-a/board/board.h @@ -29,7 +29,7 @@ extern "C" { #define STM32_SRAM1_START (0x20000000) #define STM32_SRAM1_END (STM32_SRAM1_START + STM32_SRAM1_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f429-armfly-v6/board/board.h b/bsp/stm32/stm32f429-armfly-v6/board/board.h index c0d30df246..102b68f765 100644 --- a/bsp/stm32/stm32f429-armfly-v6/board/board.h +++ b/bsp/stm32/stm32f429-armfly-v6/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_FLASH_SIZE (2 * 1024 * 1024) #define STM32_FLASH_END_ADDRESS ((uint32_t)(STM32_FLASH_START_ADRESS + STM32_FLASH_SIZE)) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f429-atk-apollo/board/board.h b/bsp/stm32/stm32f429-atk-apollo/board/board.h index 077b0af713..e07f601b84 100644 --- a/bsp/stm32/stm32f429-atk-apollo/board/board.h +++ b/bsp/stm32/stm32f429-atk-apollo/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE (192) #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f429-fire-challenger/board/board.h b/bsp/stm32/stm32f429-fire-challenger/board/board.h index c51f6a93cc..6a205b9393 100644 --- a/bsp/stm32/stm32f429-fire-challenger/board/board.h +++ b/bsp/stm32/stm32f429-fire-challenger/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_FLASH_SIZE (1024 * 1024) #define STM32_FLASH_END_ADDRESS ((uint32_t)(STM32_FLASH_START_ADRESS + STM32_FLASH_SIZE)) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f429-st-disco/board/board.h b/bsp/stm32/stm32f429-st-disco/board/board.h index ce8f2cc591..650b64a256 100644 --- a/bsp/stm32/stm32f429-st-disco/board/board.h +++ b/bsp/stm32/stm32f429-st-disco/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_SRAM_SIZE (256 - 64) #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f446-st-nucleo/board/board.h b/bsp/stm32/stm32f446-st-nucleo/board/board.h index 8cb4438f8b..3da6cda6d2 100644 --- a/bsp/stm32/stm32f446-st-nucleo/board/board.h +++ b/bsp/stm32/stm32f446-st-nucleo/board/board.h @@ -24,7 +24,7 @@ #define STM32_SRAM_SIZE 128 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f469-st-disco/board/board.h b/bsp/stm32/stm32f469-st-disco/board/board.h index 607aa3877d..14f3a6f037 100644 --- a/bsp/stm32/stm32f469-st-disco/board/board.h +++ b/bsp/stm32/stm32f469-st-disco/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_SRAM_SIZE (384 - 64) #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f746-st-disco/board/board.h b/bsp/stm32/stm32f746-st-disco/board/board.h index b0c120fb41..877bb022cf 100644 --- a/bsp/stm32/stm32f746-st-disco/board/board.h +++ b/bsp/stm32/stm32f746-st-disco/board/board.h @@ -23,7 +23,7 @@ #define STM32_SRAM_SIZE (320) #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f746-st-nucleo/board/board.h b/bsp/stm32/stm32f746-st-nucleo/board/board.h index 3b37641ec9..0abf5077eb 100644 --- a/bsp/stm32/stm32f746-st-nucleo/board/board.h +++ b/bsp/stm32/stm32f746-st-nucleo/board/board.h @@ -23,7 +23,7 @@ #define STM32_SRAM_SIZE (256) #define STM32_SRAM_END (0x20010000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f767-atk-apollo/board/board.h b/bsp/stm32/stm32f767-atk-apollo/board/board.h index e91271055e..807daaa757 100644 --- a/bsp/stm32/stm32f767-atk-apollo/board/board.h +++ b/bsp/stm32/stm32f767-atk-apollo/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE (512) #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f767-fire-challenger-v1/board/board.h b/bsp/stm32/stm32f767-fire-challenger-v1/board/board.h index e9a1277849..cb7fa73806 100644 --- a/bsp/stm32/stm32f767-fire-challenger-v1/board/board.h +++ b/bsp/stm32/stm32f767-fire-challenger-v1/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_FLASH_SIZE (1024 * 1024) #define STM32_FLASH_END_ADDRESS ((uint32_t)(STM32_FLASH_START_ADRESS + STM32_FLASH_SIZE)) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f767-st-nucleo/board/board.h b/bsp/stm32/stm32f767-st-nucleo/board/board.h index 1d82defe0d..a721a56fc4 100644 --- a/bsp/stm32/stm32f767-st-nucleo/board/board.h +++ b/bsp/stm32/stm32f767-st-nucleo/board/board.h @@ -24,7 +24,7 @@ #define STM32_SRAM_SIZE (512) #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32f769-st-disco/board/board.h b/bsp/stm32/stm32f769-st-disco/board/board.h index 813dd5b27e..5694d51bd4 100644 --- a/bsp/stm32/stm32f769-st-disco/board/board.h +++ b/bsp/stm32/stm32f769-st-disco/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE (512) #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32g070-st-nucleo/board/board.h b/bsp/stm32/stm32g070-st-nucleo/board/board.h index d36387892b..d492da1eb9 100644 --- a/bsp/stm32/stm32g070-st-nucleo/board/board.h +++ b/bsp/stm32/stm32g070-st-nucleo/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_SRAM_SIZE 36 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32g071-st-nucleo/board/board.h b/bsp/stm32/stm32g071-st-nucleo/board/board.h index d36387892b..d492da1eb9 100644 --- a/bsp/stm32/stm32g071-st-nucleo/board/board.h +++ b/bsp/stm32/stm32g071-st-nucleo/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_SRAM_SIZE 36 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32g431-st-nucleo/board/board.h b/bsp/stm32/stm32g431-st-nucleo/board/board.h index 6fd0c97890..d7d48a2db7 100644 --- a/bsp/stm32/stm32g431-st-nucleo/board/board.h +++ b/bsp/stm32/stm32g431-st-nucleo/board/board.h @@ -24,7 +24,7 @@ #define STM32_SRAM_SIZE 32 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32g474-st-nucleo/board/board.h b/bsp/stm32/stm32g474-st-nucleo/board/board.h index 6fd0c97890..d7d48a2db7 100644 --- a/bsp/stm32/stm32g474-st-nucleo/board/board.h +++ b/bsp/stm32/stm32g474-st-nucleo/board/board.h @@ -24,7 +24,7 @@ #define STM32_SRAM_SIZE 32 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32h743-armfly-V7/board/board.h b/bsp/stm32/stm32h743-armfly-V7/board/board.h index 32eb25f147..d511a1f847 100644 --- a/bsp/stm32/stm32h743-armfly-V7/board/board.h +++ b/bsp/stm32/stm32h743-armfly-V7/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE (512) #define STM32_SRAM_END (0x24000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32h743-atk-apollo/board/board.h b/bsp/stm32/stm32h743-atk-apollo/board/board.h index c9ec7a30d9..10fe8dae36 100644 --- a/bsp/stm32/stm32h743-atk-apollo/board/board.h +++ b/bsp/stm32/stm32h743-atk-apollo/board/board.h @@ -31,7 +31,7 @@ extern "C" { #define STM32_SRAM_SIZE (512) #define STM32_SRAM_END (0x24000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32h743-openmv-h7plus/board/board.h b/bsp/stm32/stm32h743-openmv-h7plus/board/board.h index c2bf0c0323..b1e723057d 100644 --- a/bsp/stm32/stm32h743-openmv-h7plus/board/board.h +++ b/bsp/stm32/stm32h743-openmv-h7plus/board/board.h @@ -29,7 +29,7 @@ extern "C" { #define STM32_SRAM1_START (0x20000000) #define STM32_SRAM1_END (STM32_SRAM1_START + STM32_SRAM1_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32h743-st-nucleo/board/board.h b/bsp/stm32/stm32h743-st-nucleo/board/board.h index 32eb25f147..d511a1f847 100644 --- a/bsp/stm32/stm32h743-st-nucleo/board/board.h +++ b/bsp/stm32/stm32h743-st-nucleo/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE (512) #define STM32_SRAM_END (0x24000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32h747-st-discovery/board/board.h b/bsp/stm32/stm32h747-st-discovery/board/board.h index 85196a7664..f13926d8a7 100644 --- a/bsp/stm32/stm32h747-st-discovery/board/board.h +++ b/bsp/stm32/stm32h747-st-discovery/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE (128) #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32h750-armfly-h7-tool/board/board.h b/bsp/stm32/stm32h750-armfly-h7-tool/board/board.h index b41ed17e43..657a668b64 100644 --- a/bsp/stm32/stm32h750-armfly-h7-tool/board/board.h +++ b/bsp/stm32/stm32h750-armfly-h7-tool/board/board.h @@ -27,7 +27,7 @@ extern "C" { #define STM32_SRAM_SIZE (128) #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32h750-artpi-h750/board/board.h b/bsp/stm32/stm32h750-artpi-h750/board/board.h index ac48db06bf..61b43c8c23 100644 --- a/bsp/stm32/stm32h750-artpi-h750/board/board.h +++ b/bsp/stm32/stm32h750-artpi-h750/board/board.h @@ -77,7 +77,7 @@ extern "C" { #define STM32_SRAM1_START RAM_START #define STM32_SRAM1_END RAM_END -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32l010-st-nucleo/board/board.h b/bsp/stm32/stm32l010-st-nucleo/board/board.h index 67e4ad5ec0..3e6096d63d 100644 --- a/bsp/stm32/stm32l010-st-nucleo/board/board.h +++ b/bsp/stm32/stm32l010-st-nucleo/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_SRAM_SIZE 20 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32l053-st-nucleo/board/board.h b/bsp/stm32/stm32l053-st-nucleo/board/board.h index f88ee51946..91745ef064 100644 --- a/bsp/stm32/stm32l053-st-nucleo/board/board.h +++ b/bsp/stm32/stm32l053-st-nucleo/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_SRAM_SIZE 8 #define STM32_SRAM_END (0x20000000 + STM32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32l433-ali-startkit/board/board.h b/bsp/stm32/stm32l433-ali-startkit/board/board.h index 5046836891..59c7733604 100644 --- a/bsp/stm32/stm32l433-ali-startkit/board/board.h +++ b/bsp/stm32/stm32l433-ali-startkit/board/board.h @@ -34,7 +34,7 @@ extern "C" { #define STM32_FLASH_SIZE (256 * 1024) #define STM32_FLASH_END_ADDRESS ((uint32_t)(STM32_FLASH_START_ADRESS + STM32_FLASH_SIZE)) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32l452-st-nucleo/board/board.h b/bsp/stm32/stm32l452-st-nucleo/board/board.h index 0c9006dc40..9c481c4983 100644 --- a/bsp/stm32/stm32l452-st-nucleo/board/board.h +++ b/bsp/stm32/stm32l452-st-nucleo/board/board.h @@ -29,7 +29,7 @@ extern "C" { #define STM32_SRAM1_START (0x20000000) #define STM32_SRAM1_END (STM32_SRAM1_START + STM32_SRAM1_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32l475-atk-pandora/board/board.h b/bsp/stm32/stm32l475-atk-pandora/board/board.h index a1029a3e99..c91fb31d23 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/board.h +++ b/bsp/stm32/stm32l475-atk-pandora/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_SRAM1_START (0x20000000) #define STM32_SRAM1_END (STM32_SRAM1_START + STM32_SRAM1_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32l496-ali-developer/board/board.h b/bsp/stm32/stm32l496-ali-developer/board/board.h index 8c0daff8b5..dc2db87b70 100644 --- a/bsp/stm32/stm32l496-ali-developer/board/board.h +++ b/bsp/stm32/stm32l496-ali-developer/board/board.h @@ -39,7 +39,7 @@ extern "C" { #define STM32_FLASH_SIZE (1024 * 1024) #define STM32_FLASH_END_ADDRESS ((uint32_t)(STM32_FLASH_START_ADRESS + STM32_FLASH_SIZE)) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32l496-st-nucleo/board/board.h b/bsp/stm32/stm32l496-st-nucleo/board/board.h index f9edac21da..63f09134c0 100644 --- a/bsp/stm32/stm32l496-st-nucleo/board/board.h +++ b/bsp/stm32/stm32l496-st-nucleo/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_SRAM1_START (0x20000000) #define STM32_SRAM1_END (STM32_SRAM1_START + STM32_SRAM1_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32l4r9-st-sensortile-box/board/board.h b/bsp/stm32/stm32l4r9-st-sensortile-box/board/board.h index 049be64f38..9a9df06b23 100644 --- a/bsp/stm32/stm32l4r9-st-sensortile-box/board/board.h +++ b/bsp/stm32/stm32l4r9-st-sensortile-box/board/board.h @@ -28,7 +28,7 @@ extern "C" { #define STM32_SRAM1_START (0x20000000) #define STM32_SRAM1_END (STM32_SRAM1_START + STM32_SRAM1_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32l552-st-nucleo/board/board.h b/bsp/stm32/stm32l552-st-nucleo/board/board.h index 049dfd05fb..479a4262fb 100644 --- a/bsp/stm32/stm32l552-st-nucleo/board/board.h +++ b/bsp/stm32/stm32l552-st-nucleo/board/board.h @@ -29,7 +29,7 @@ extern "C" { #define STM32_SRAM1_START (0x20000000) #define STM32_SRAM1_END (STM32_SRAM1_START + STM32_SRAM1_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32mp157a-st-discovery/board/board.h b/bsp/stm32/stm32mp157a-st-discovery/board/board.h index 0b60c68af4..332f4ad308 100644 --- a/bsp/stm32/stm32mp157a-st-discovery/board/board.h +++ b/bsp/stm32/stm32mp157a-st-discovery/board/board.h @@ -29,7 +29,7 @@ extern "C" { #define STM32_SRAM_SIZE (64) #define STM32_SRAM_END (0x10030000 + 64 * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32mp157a-st-discovery/board/ports/audio/drv_mic.c b/bsp/stm32/stm32mp157a-st-discovery/board/ports/audio/drv_mic.c index 45b0afe762..35c4d0a342 100644 --- a/bsp/stm32/stm32mp157a-st-discovery/board/ports/audio/drv_mic.c +++ b/bsp/stm32/stm32mp157a-st-discovery/board/ports/audio/drv_mic.c @@ -24,7 +24,7 @@ /* SYSRAM */ #define RX_FIFO_SIZE (4096) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) rt_uint8_t MIC_RX_FIFO[RX_FIFO_SIZE] __attribute__((at(0x2FFC2000))); #elif defined(__ICCARM__) #pragma location = 0x2FFC2000 diff --git a/bsp/stm32/stm32mp157a-st-discovery/board/ports/audio/drv_sound.c b/bsp/stm32/stm32mp157a-st-discovery/board/ports/audio/drv_sound.c index 6a057fa72f..89f7704145 100644 --- a/bsp/stm32/stm32mp157a-st-discovery/board/ports/audio/drv_sound.c +++ b/bsp/stm32/stm32mp157a-st-discovery/board/ports/audio/drv_sound.c @@ -22,7 +22,7 @@ /* SYSRAM */ #define TX_FIFO_SIZE (4096) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) rt_uint8_t AUDIO_TX_FIFO[TX_FIFO_SIZE] __attribute__((at(0x2FFC3000))); #elif defined(__ICCARM__) #pragma location = 0x2FFC3000 diff --git a/bsp/stm32/stm32mp157a-st-discovery/board/ports/drv_eth.c b/bsp/stm32/stm32mp157a-st-discovery/board/ports/drv_eth.c index 229c3e585e..8de506591a 100644 --- a/bsp/stm32/stm32mp157a-st-discovery/board/ports/drv_eth.c +++ b/bsp/stm32/stm32mp157a-st-discovery/board/ports/drv_eth.c @@ -44,7 +44,7 @@ static TxDmaDesc txDmaDesc[ETH_TXBUFNB]; #pragma location = RX_DMA_ADD_BASE static RxDmaDesc rxDmaDesc[ETH_RXBUFNB]; -#elif defined(__CC_ARM) || defined(__CLANG_ARM) +#elif defined(__ARMCC_VERSION) /* transmit buffer */ static rt_uint8_t txBuffer[ETH_TXBUFNB][ETH_TX_BUF_SIZE] __attribute__((at(TX_ADD_BASE))); /* Receive buffer */ diff --git a/bsp/stm32/stm32mp157a-st-discovery/board/ports/drv_sdio.c b/bsp/stm32/stm32mp157a-st-discovery/board/ports/drv_sdio.c index 9d128a2892..21d207c24c 100644 --- a/bsp/stm32/stm32mp157a-st-discovery/board/ports/drv_sdio.c +++ b/bsp/stm32/stm32mp157a-st-discovery/board/ports/drv_sdio.c @@ -55,7 +55,7 @@ struct rthw_sdio /* SYSRAM SDMMC1/2 accesses */ #define SDCARD_ADDR 0x2FFFF000 -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) __attribute__((at(SDCARD_ADDR))) static rt_uint8_t cache_buf[SDIO_BUFF_SIZE]; #elif defined ( __GNUC__ ) static rt_uint8_t cache_buf[SDIO_BUFF_SIZE] __attribute__((section(".SdCardSection"))); diff --git a/bsp/stm32/stm32mp157a-st-ev1/board/board.h b/bsp/stm32/stm32mp157a-st-ev1/board/board.h index 0406e49952..5775caf20b 100644 --- a/bsp/stm32/stm32mp157a-st-ev1/board/board.h +++ b/bsp/stm32/stm32mp157a-st-ev1/board/board.h @@ -30,7 +30,7 @@ extern "C" { #define STM32_SRAM_SIZE (64) #define STM32_SRAM_END (0x10030000 + 64 * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN (&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_dfsdm.c b/bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_dfsdm.c index 61600fbd00..990537241e 100644 --- a/bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_dfsdm.c +++ b/bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_dfsdm.c @@ -19,7 +19,7 @@ #include #define FILTER_FIFO_SIZE (1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) __attribute__((at(0x2FFC8000))) static rt_int32_t FILTER0_FIFO[FILTER_FIFO_SIZE]; #elif defined ( __GNUC__ ) static rt_int32_t FILTER0_FIFO[FILTER_FIFO_SIZE] __attribute__((section(".Filter0Section"))); @@ -28,7 +28,7 @@ static rt_int32_t FILTER0_FIFO[FILTER_FIFO_SIZE] __attribute__((section(".Filter __no_init static rt_int32_t FILTER0_FIFO[FILTER_FIFO_SIZE]; #endif -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) __attribute__((at(0x2FFC9000))) static rt_int32_t FILTER0_FIFO[FILTER_FIFO_SIZE]; #elif defined ( __GNUC__ ) static rt_int32_t FILTER0_FIFO[FILTER_FIFO_SIZE] __attribute__((section(".Filter1Section"))); @@ -38,7 +38,7 @@ __no_init static rt_int32_t FILTER1_FIFO[FILTER_FIFO_SIZE]; #endif #define PALY_SIZE 2048 -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) __attribute__((at(0x2FFCA000))) static rt_int16_t PLAY_BUF[PALY_SIZE]; #elif defined ( __GNUC__ ) __attribute__((at(0x2FFCA000))) __attribute__((section(".DfsdmSection"))); diff --git a/bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_emmc.c b/bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_emmc.c index 2da6ddc485..b935c40df2 100644 --- a/bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_emmc.c +++ b/bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_emmc.c @@ -50,7 +50,7 @@ struct rthw_sdio #define EMMC_BUFF_SIZE 4096 #define EMMC_BUFF_ADDR 0x2FFCB000 -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) __attribute__((at(EMMC_BUFF_ADDR))) static rt_uint8_t cache_buf[EMMC_BUFF_SIZE]; #elif defined ( __GNUC__ ) static rt_uint8_t cache_buf[EMMC_BUFF_SIZE] __attribute__((section(".eMMCSection"))); diff --git a/bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_ov5640.c b/bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_ov5640.c index da4d602a67..69af85e27b 100644 --- a/bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_ov5640.c +++ b/bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_ov5640.c @@ -27,7 +27,7 @@ #define JPEG_BUF_SIZE 8 * 1024 #define JPEG_LINE_SIZE 1 * 1024 -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) __attribute__((at(0x2FFCC000))) static rt_int32_t JPEG_DATA_BUF[JPEG_BUF_SIZE]; #elif defined(__GNUC__) static rt_int32_t JPEG_DATA_BUF[JPEG_BUF_SIZE] __attribute__((section(".Dcmi0Section"))); @@ -36,7 +36,7 @@ static rt_int32_t JPEG_DATA_BUF[JPEG_BUF_SIZE] __attribute__((section(".Dcmi0Sec __no_init static rt_int32_t JPEG_DATA_BUF[JPEG_BUF_SIZE]; #endif -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) __attribute__((at(0x2FFDC000))) static rt_int32_t JPEG_LINE_BUF[2][JPEG_LINE_SIZE]; #elif defined(__GNUC__) static rt_int32_t JPEG_LINE_BUF[2][JPEG_LINE_SIZE] __attribute__((section(".Dcmi1Section"))); diff --git a/bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_sdcard.c b/bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_sdcard.c index bb6e92584f..b8f524e59a 100644 --- a/bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_sdcard.c +++ b/bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_sdcard.c @@ -42,7 +42,7 @@ struct rt_completion rx_comp; /* SYSRAM SDMMC1/2 accesses */ #define SDIO_BUFF_SIZE 512 #define SDCARD_ADDR 0x2FFC0000 -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) __attribute__((at(SDCARD_ADDR))) static rt_uint32_t cache_buf[SDIO_BUFF_SIZE]; #elif defined ( __GNUC__ ) static rt_uint32_t cache_buf[SDIO_BUFF_SIZE] __attribute__((section(".SdCardSection"))); diff --git a/bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_sound.c b/bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_sound.c index 4aee045825..b9e76a0703 100644 --- a/bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_sound.c +++ b/bsp/stm32/stm32mp157a-st-ev1/board/ports/drv_sound.c @@ -22,7 +22,7 @@ #define SOUND_BUS_NAME "i2c2" #define TX_FIFO_SIZE (4096) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) __attribute__((at(0x2FFC2000))) static rt_uint8_t AUDIO_TX_FIFO[TX_FIFO_SIZE]; #elif defined ( __GNUC__ ) static rt_uint8_t AUDIO_TX_FIFO[TX_FIFO_SIZE] __attribute__((section(".AudioSection"))); diff --git a/bsp/stm32/stm32mp157a-st-ev1/board/ports/eth/drv_eth.c b/bsp/stm32/stm32mp157a-st-ev1/board/ports/eth/drv_eth.c index 670a00e35e..4f7bea280d 100644 --- a/bsp/stm32/stm32mp157a-st-ev1/board/ports/eth/drv_eth.c +++ b/bsp/stm32/stm32mp157a-st-ev1/board/ports/eth/drv_eth.c @@ -44,7 +44,7 @@ __no_init static TxDmaDesc txDmaDesc[ETH_TXBUFNB]; #pragma location = RX_DMA_ADD_BASE __no_init static RxDmaDesc rxDmaDesc[ETH_RXBUFNB]; -#elif defined(__CC_ARM) || defined(__CLANG_ARM) +#elif defined(__ARMCC_VERSION) /* transmit buffer */ static rt_uint8_t txBuffer[ETH_TXBUFNB][ETH_TX_BUF_SIZE] __attribute__((at(TX_ADD_BASE))); /* Receive buffer */ diff --git a/bsp/stm32/stm32u575-st-nucleo/board/board.h b/bsp/stm32/stm32u575-st-nucleo/board/board.h index 8a5abd8190..21566e54c8 100644 --- a/bsp/stm32/stm32u575-st-nucleo/board/board.h +++ b/bsp/stm32/stm32u575-st-nucleo/board/board.h @@ -29,7 +29,7 @@ extern "C" { #define STM32_SRAM1_START (0x20000000) #define STM32_SRAM1_END (STM32_SRAM1_START + STM32_SRAM1_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/stm32/stm32wb55-st-nucleo/board/board.h b/bsp/stm32/stm32wb55-st-nucleo/board/board.h index 366ef99b50..869826a3c2 100644 --- a/bsp/stm32/stm32wb55-st-nucleo/board/board.h +++ b/bsp/stm32/stm32wb55-st-nucleo/board/board.h @@ -29,7 +29,7 @@ extern "C" { #define STM32_SRAM1_START (0x20000000) #define STM32_SRAM1_END (STM32_SRAM1_START + STM32_SRAM1_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/swm320-lq100/drivers/board.h b/bsp/swm320-lq100/drivers/board.h index 223018920f..c139890e57 100644 --- a/bsp/swm320-lq100/drivers/board.h +++ b/bsp/swm320-lq100/drivers/board.h @@ -34,7 +34,7 @@ extern "C" #define EXT_SRAM_END (EXT_SRAM_BASE + EXT_SRAM_SIZE) #endif -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/swm320/drivers/board.h b/bsp/swm320/drivers/board.h index 223018920f..c139890e57 100644 --- a/bsp/swm320/drivers/board.h +++ b/bsp/swm320/drivers/board.h @@ -34,7 +34,7 @@ extern "C" #define EXT_SRAM_END (EXT_SRAM_BASE + EXT_SRAM_SIZE) #endif -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/tm4c123bsp/board/board.h b/bsp/tm4c123bsp/board/board.h index f12ba9c5b5..0f8c5aff40 100644 --- a/bsp/tm4c123bsp/board/board.h +++ b/bsp/tm4c123bsp/board/board.h @@ -18,7 +18,7 @@ #define TM4C123_SRAM1_START (0x20000000) #define TM4C123_SRAM1_END (TM4C123_SRAM1_START + 32 * 1024) // end address = 0x20000000(base adddress) + 32K(RAM size) - #if defined(__CC_ARM) || defined(__CLANG_ARM) + #if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM$$ZI$$Limit; // RW_IRAM #define HEAP_BEGIN ((void *)&Image$$RW_IRAM$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/wch/arm/ch32f103c8-core/board/board.h b/bsp/wch/arm/ch32f103c8-core/board/board.h index a606f4dc03..f4073203a7 100644 --- a/bsp/wch/arm/ch32f103c8-core/board/board.h +++ b/bsp/wch/arm/ch32f103c8-core/board/board.h @@ -26,7 +26,7 @@ extern "C" { #define CH32_SRAM_SIZE 20 #define CH32_SRAM_END (0x20000000 + CH32_SRAM_SIZE * 1024) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/bsp/yichip/yc3121-pos/drivers/board.h b/bsp/yichip/yc3121-pos/drivers/board.h index 573c6454a9..59b21029e8 100644 --- a/bsp/yichip/yc3121-pos/drivers/board.h +++ b/bsp/yichip/yc3121-pos/drivers/board.h @@ -28,7 +28,7 @@ #endif #define SRAM_END (SRAM_BASE + SRAM_SIZE) -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int Image$$RW_IRAM1$$ZI$$Limit; #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit) #elif __ICCARM__ diff --git a/components/cplusplus/cxx_crt_init.c b/components/cplusplus/cxx_crt_init.c index 977dee6ee9..46946089ff 100644 --- a/components/cplusplus/cxx_crt_init.c +++ b/components/cplusplus/cxx_crt_init.c @@ -13,7 +13,7 @@ #include -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern void $Super$$__cpp_initialize__aeabi_(void); /* we need to change the cpp_initialize order */ RT_WEAK void $Sub$$__cpp_initialize__aeabi_(void) @@ -36,7 +36,7 @@ RT_WEAK void *__dso_handle = 0; RT_WEAK int cplusplus_system_init(void) { -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) /* If there is no SHT$$INIT_ARRAY, calling * $Super$$__cpp_initialize__aeabi_() will cause fault. At least until Keil5.12 * the problem still exists. So we have to initialize the C++ runtime by ourself. diff --git a/components/libc/compilers/armlibc/syscalls.c b/components/libc/compilers/armlibc/syscalls.c index 54d8b40bf6..14b47d3627 100644 --- a/components/libc/compilers/armlibc/syscalls.c +++ b/components/libc/compilers/armlibc/syscalls.c @@ -30,11 +30,11 @@ #define DBG_LVL DBG_INFO #include -#ifdef __CLANG_ARM +#ifdef __clang__ __asm(".global __use_no_semihosting\n\t"); #else #pragma import(__use_no_semihosting_swi) -#endif /* __CLANG_ARM */ +#endif /* Standard IO device handles. */ #define STDIN 0 diff --git a/components/utilities/utest/utest.c b/components/utilities/utest/utest.c index 7103efb89c..8c8ffd674a 100644 --- a/components/utilities/utest/utest.c +++ b/components/utilities/utest/utest.c @@ -68,7 +68,7 @@ void utest_log_lv_set(rt_uint8_t lv) int utest_init(void) { /* initialize the utest commands table.*/ -#if defined(__CC_ARM) || defined(__CLANG_ARM) /* ARM C Compiler */ +#if defined(__ARMCC_VERSION) /* ARM C Compiler */ extern const int UtestTcTab$$Base; extern const int UtestTcTab$$Limit; tc_table = (utest_tc_export_t)&UtestTcTab$$Base; diff --git a/components/utilities/var_export/var_export.c b/components/utilities/var_export/var_export.c index f4623dec04..1e54f39362 100644 --- a/components/utilities/var_export/var_export.c +++ b/components/utilities/var_export/var_export.c @@ -20,7 +20,7 @@ static rt_size_t ve_exporter_num = 0; #endif /* for ARM C and IAR Compiler */ -#if defined(__CC_ARM) || defined(__CLANG_ARM) || defined (__ICCARM__) || defined(__ICCRX__) +#if defined(__ARMCC_VERSION) || defined (__ICCARM__) || defined(__ICCRX__) static RT_USED const struct ve_exporter __ve_table_start RT_SECTION("0.""VarExpTab") = {"ve_start", "ve_start", 0}; @@ -43,7 +43,7 @@ RT_USED const struct ve_exporter __ve_table_end = { "ve_end", "ve_end", 2}; int var_export_init(void) { /* initialize the var export table.*/ -#if defined(__CC_ARM) || defined(__CLANG_ARM) /* for ARM C Compiler */ +#if defined(__ARMCC_VERSION) /* for ARM C Compiler */ ve_exporter_table = &__ve_table_start + 1; ve_exporter_num = &__ve_table_end - &__ve_table_start; #elif defined (__GNUC__) /* for GCC Compiler */ @@ -94,7 +94,7 @@ int var_export_init(void) } } ve_exporter_table = ve_exporter_tab; -#endif /* __CC_ARM || __CLANG_ARM */ +#endif /* __ARMCC_VERSION */ return ve_exporter_num; } diff --git a/include/rtdef.h b/include/rtdef.h index b31bd1e3f8..bc133d4271 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -115,10 +115,6 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ #define RT_MB_ENTRY_MAX RT_UINT16_MAX /**< Maxium number of mailbox .entry */ #define RT_MQ_ENTRY_MAX RT_UINT16_MAX /**< Maxium number of message queue .entry */ -#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) -#define __CLANG_ARM -#endif - #define RT_UNUSED(x) ((void)x) /* Compiler Related Definitions */ diff --git a/libcpu/arm/cortex-m3/cpuport.c b/libcpu/arm/cortex-m3/cpuport.c index d376f00424..66e2aa4809 100644 --- a/libcpu/arm/cortex-m3/cpuport.c +++ b/libcpu/arm/cortex-m3/cpuport.c @@ -385,7 +385,7 @@ __asm int __rt_ffs(int value) exit BX lr } -#elif defined(__CLANG_ARM) +#elif defined(__clang__) int __rt_ffs(int value) { __asm volatile( diff --git a/libcpu/arm/cortex-m33/cpuport.c b/libcpu/arm/cortex-m33/cpuport.c index aa2325012c..71e1fea848 100644 --- a/libcpu/arm/cortex-m33/cpuport.c +++ b/libcpu/arm/cortex-m33/cpuport.c @@ -20,7 +20,7 @@ #include #if /* ARMCC */ ( (defined ( __CC_ARM ) && defined ( __TARGET_FPU_VFP )) \ - /* Clang */ || (defined ( __CLANG_ARM ) && defined ( __VFP_FP__ ) && !defined(__SOFTFP__)) \ + /* Clang */ || (defined ( __clang__ ) && defined ( __VFP_FP__ ) && !defined(__SOFTFP__)) \ /* IAR */ || (defined ( __ICCARM__ ) && defined ( __ARMVFP__ )) \ /* GNU */ || (defined ( __GNUC__ ) && defined ( __VFP_FP__ ) && !defined(__SOFTFP__)) ) #define USE_FPU 1 @@ -472,7 +472,7 @@ __asm int __rt_ffs(int value) exit BX lr } -#elif defined(__CLANG_ARM) +#elif defined(__clang__) int __rt_ffs(int value) { if (value == 0) return value; diff --git a/libcpu/arm/cortex-m33/trustzone.c b/libcpu/arm/cortex-m33/trustzone.c index f49f0c24f8..2cc19a06e4 100644 --- a/libcpu/arm/cortex-m33/trustzone.c +++ b/libcpu/arm/cortex-m33/trustzone.c @@ -37,7 +37,7 @@ static __inline rt_uint32_t __get_IPSR(void) register rt_uint32_t result __asm("ipsr"); return(result); } -#elif defined(__CLANG_ARM) +#elif defined(__clang__) __attribute__((always_inline)) static __inline rt_uint32_t __get_IPSR(void) { rt_uint32_t result; diff --git a/libcpu/arm/cortex-m4/cpuport.c b/libcpu/arm/cortex-m4/cpuport.c index f24c33cf4d..6b748255c5 100644 --- a/libcpu/arm/cortex-m4/cpuport.c +++ b/libcpu/arm/cortex-m4/cpuport.c @@ -20,7 +20,7 @@ #include #if /* ARMCC */ ( (defined ( __CC_ARM ) && defined ( __TARGET_FPU_VFP )) \ - /* Clang */ || (defined ( __CLANG_ARM ) && defined ( __VFP_FP__ ) && !defined(__SOFTFP__)) \ + /* Clang */ || (defined ( __clang__ ) && defined ( __VFP_FP__ ) && !defined(__SOFTFP__)) \ /* IAR */ || (defined ( __ICCARM__ ) && defined ( __ARMVFP__ )) \ /* GNU */ || (defined ( __GNUC__ ) && defined ( __VFP_FP__ ) && !defined(__SOFTFP__)) ) #define USE_FPU 1 @@ -469,7 +469,7 @@ __asm int __rt_ffs(int value) exit BX lr } -#elif defined(__CLANG_ARM) +#elif defined(__clang__) int __rt_ffs(int value) { __asm volatile( diff --git a/libcpu/arm/cortex-m7/cpuport.c b/libcpu/arm/cortex-m7/cpuport.c index f24c33cf4d..6b748255c5 100644 --- a/libcpu/arm/cortex-m7/cpuport.c +++ b/libcpu/arm/cortex-m7/cpuport.c @@ -20,7 +20,7 @@ #include #if /* ARMCC */ ( (defined ( __CC_ARM ) && defined ( __TARGET_FPU_VFP )) \ - /* Clang */ || (defined ( __CLANG_ARM ) && defined ( __VFP_FP__ ) && !defined(__SOFTFP__)) \ + /* Clang */ || (defined ( __clang__ ) && defined ( __VFP_FP__ ) && !defined(__SOFTFP__)) \ /* IAR */ || (defined ( __ICCARM__ ) && defined ( __ARMVFP__ )) \ /* GNU */ || (defined ( __GNUC__ ) && defined ( __VFP_FP__ ) && !defined(__SOFTFP__)) ) #define USE_FPU 1 @@ -469,7 +469,7 @@ __asm int __rt_ffs(int value) exit BX lr } -#elif defined(__CLANG_ARM) +#elif defined(__clang__) int __rt_ffs(int value) { __asm volatile( diff --git a/libcpu/sim/win32/startup.c b/libcpu/sim/win32/startup.c index 756d409315..e3e76323b9 100644 --- a/libcpu/sim/win32/startup.c +++ b/libcpu/sim/win32/startup.c @@ -199,7 +199,7 @@ void rt_application_init(void); void rt_hw_board_init(void); int rtthread_startup(void); -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) extern int $Super$$main(void); /* re-define main function */ int $Sub$$main(void) @@ -248,7 +248,7 @@ void main_thread_entry(void *parameter) rt_hw_secondary_cpu_up(); #endif /* invoke system main function */ -#if defined(__CC_ARM) || defined(__CLANG_ARM) +#if defined(__ARMCC_VERSION) { extern int $Super$$main(void); $Super$$main(); /* for ARMCC. */ -- cgit v1.3.1 From 2fa1a9349791770678b5924b709d9764d767f9b0 Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Thu, 30 Dec 2021 09:06:46 +0800 Subject: Revert "Add support for IAR Compiler" This reverts commit ead24644f008232f81e0408bfb15e99deff115bb. --- include/rtthread.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/rtthread.h b/include/rtthread.h index 1f9d3328c1..8f0f43f7cc 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -571,7 +571,7 @@ void rt_components_board_init(void); #define rt_kputs(str) #else #if defined(__ARMCC_VERSION) || defined(__GNUC__) || \ - defined(__ICCARM__) || defined(__TI_COMPILER_VERSION__) + defined(__TI_COMPILER_VERSION__) int rt_kprintf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); #else int rt_kprintf(const char *fmt, ...); -- cgit v1.3.1 From 634a06c3cb41d431be8ef6c75cf975c0c5a3cbb9 Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Thu, 30 Dec 2021 09:06:46 +0800 Subject: Revert "[kernel] Add __attribute__(...) for rt_kprintf() to let the compiler check the format string parameters" This reverts commit d2e6715ddbc03f5e6d0bb3f44e5eb73135a5b258. --- include/rtthread.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'include') diff --git a/include/rtthread.h b/include/rtthread.h index 8f0f43f7cc..d18355c426 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -570,12 +570,7 @@ void rt_components_board_init(void); #define rt_kprintf(...) #define rt_kputs(str) #else -#if defined(__ARMCC_VERSION) || defined(__GNUC__) || \ - defined(__TI_COMPILER_VERSION__) -int rt_kprintf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); -#else int rt_kprintf(const char *fmt, ...); -#endif void rt_kputs(const char *str); #endif -- cgit v1.3.1 From 2babae231fb970c8c31cbb7defae5eb64129b703 Mon Sep 17 00:00:00 2001 From: balanceTWK Date: Mon, 3 Jan 2022 22:30:45 +0800 Subject: [include/rtthread.h] Add function declarations to avoid compilation warnings. --- include/rtthread.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/rtthread.h b/include/rtthread.h index d18355c426..120f565f3e 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -410,6 +410,7 @@ rt_err_t rt_mb_send(rt_mailbox_t mb, rt_ubase_t value); rt_err_t rt_mb_send_wait(rt_mailbox_t mb, rt_ubase_t value, rt_int32_t timeout); +rt_err_t rt_mb_urgent(rt_mailbox_t mb, rt_ubase_t value); rt_err_t rt_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout); rt_err_t rt_mb_control(rt_mailbox_t mb, int cmd, void *arg); #endif -- cgit v1.3.1 From b627414f67cef4fff44faefac61c512fa19ecbe4 Mon Sep 17 00:00:00 2001 From: Gabriel Wang Date: Sat, 1 Jan 2022 16:37:41 +0000 Subject: Improving hooking methods - Backward compatible with existing function-pointer based hooking method - Using RT_USING_HOOK as an on/off switch - Introducing a new low-overhead macro-based hooking method --- include/rtdef.h | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 68 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/rtdef.h b/include/rtdef.h index bc133d4271..a018ceb21d 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -38,6 +38,7 @@ * 2021-05-10 armink change version number to v4.0.4 * 2021-11-19 Meco Man change version number to v4.1.0 * 2021-12-21 Meco Man re-implement RT_UNUSED + * 2022-01-01 Gabriel improve hooking method */ #ifndef __RT_DEF_H__ @@ -437,11 +438,74 @@ struct rt_object_information /** * The hook function call macro */ -#ifdef RT_USING_HOOK -#define RT_OBJECT_HOOK_CALL(func, argv) \ - do { if ((func) != RT_NULL) func argv; } while (0) +#ifndef RT_USING_HOOK + #define __ON_HOOK_ARGS(__hook, argv) + #define RT_OBJECT_HOOK_CALL(func, argv) #else -#define RT_OBJECT_HOOK_CALL(func, argv) + #define RT_OBJECT_HOOK_CALL(func, argv) __on_##func argv + #ifdef RT_HOOK_USING_FUNC_PTR + #define __ON_HOOK_ARGS(__hook, argv) do {if ((__hook) != RT_NULL) __hook argv; } while (0) + #else + #define __ON_HOOK_ARGS(__hook, argv) + #endif +#endif + +#ifndef __on_rt_interrupt_enter_hook + #define __on_rt_interrupt_enter_hook() __ON_HOOK_ARGS(rt_interrupt_enter_hook, ()) +#endif +#ifndef __on_rt_interrupt_leave_hook + #define __on_rt_interrupt_leave_hook() __ON_HOOK_ARGS(rt_interrupt_leave_hook, ()) +#endif +#ifndef __on_rt_interrupt_switch_hook + #define __on_rt_interrupt_switch_hook() __ON_HOOK_ARGS(rt_interrupt_switch_hook, ()) +#endif +#ifndef __on_rt_malloc_hook + #define __on_rt_malloc_hook(addr, size) __ON_HOOK_ARGS(rt_malloc_hook, (addr, size)) +#endif +#ifndef __on_rt_free_hook + #define __on_rt_free_hook(rmem) __ON_HOOK_ARGS(rt_free_hook, (rmem)) +#endif +#ifndef __on_rt_mp_alloc_hook + #define __on_rt_mp_alloc_hook(mp, block) __ON_HOOK_ARGS(rt_mp_alloc_hook, (mp, block)) +#endif +#ifndef __on_rt_mp_free_hook + #define __on_rt_mp_free_hook(mp, block) __ON_HOOK_ARGS(rt_mp_free_hook, (mp, block)) +#endif +#ifndef __on_rt_object_trytake_hook + #define __on_rt_object_trytake_hook(parent) __ON_HOOK_ARGS(rt_object_trytake_hook, (parent)) +#endif +#ifndef __on_rt_object_take_hook + #define __on_rt_object_take_hook(parent) __ON_HOOK_ARGS(rt_object_take_hook, (parent)) +#endif +#ifndef __on_rt_object_put_hook + #define __on_rt_object_put_hook(parent) __ON_HOOK_ARGS(rt_object_put_hook, (parent)) +#endif +#ifndef __on_rt_scheduler_hook + #define __on_rt_scheduler_hook(from, to) __ON_HOOK_ARGS(rt_scheduler_hook, (from, to)) +#endif +#ifndef __on_rt_scheduler_switch_hook + #define __on_rt_scheduler_switch_hook(tid) __ON_HOOK_ARGS(rt_scheduler_switch_hook, (tid)) +#endif +#ifndef __on_rt_object_attach_hook + #define __on_rt_object_attach_hook(obj) __ON_HOOK_ARGS(rt_object_attach_hook, (obj)) +#endif +#ifndef __on_rt_object_detach_hook + #define __on_rt_object_detach_hook(obj) __ON_HOOK_ARGS(rt_object_detach_hook, (obj)) +#endif +#ifndef __on_rt_thread_inited_hook + #define __on_rt_thread_inited_hook(thread) __ON_HOOK_ARGS(rt_thread_inited_hook, (thread)) +#endif +#ifndef __on_rt_thread_suspend_hook + #define __on_rt_thread_suspend_hook(thread) __ON_HOOK_ARGS(rt_thread_suspend_hook, (thread)) +#endif +#ifndef __on_rt_thread_resume_hook + #define __on_rt_thread_resume_hook(thread) __ON_HOOK_ARGS(rt_thread_resume_hook, (thread)) +#endif +#ifndef __on_rt_timer_enter_hook + #define __on_rt_timer_enter_hook(t) __ON_HOOK_ARGS(rt_timer_enter_hook, (t)) +#endif +#ifndef __on_rt_timer_exit_hook + #define __on_rt_timer_exit_hook(t) __ON_HOOK_ARGS(rt_timer_exit_hook, (t)) #endif /**@}*/ -- cgit v1.3.1 From d7b8cf81e6285f3cbb0817cbe79c527f10ff56b7 Mon Sep 17 00:00:00 2001 From: Gabriel Wang Date: Fri, 7 Jan 2022 23:35:44 +0000 Subject: move some __on_rt_xxxxx_hook from rtdef.h to dedicated c soure files --- include/rtdef.h | 50 ++------------------------------------------------ src/ipc.c | 14 +++++++++++++- src/irq.c | 10 +++++++++- src/kservice.c | 7 +++++++ src/mempool.c | 10 +++++++++- src/object.c | 21 ++++++++++++++++++++- src/scheduler.c | 10 +++++++++- src/thread.c | 13 ++++++++++++- src/timer.c | 16 +++++++++++++++- 9 files changed, 96 insertions(+), 55 deletions(-) (limited to 'include') diff --git a/include/rtdef.h b/include/rtdef.h index a018ceb21d..d1f7eae91f 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -39,6 +39,7 @@ * 2021-11-19 Meco Man change version number to v4.1.0 * 2021-12-21 Meco Man re-implement RT_UNUSED * 2022-01-01 Gabriel improve hooking method + * 2022-01-07 Gabriel move some __on_rt_xxxxx_hook to dedicated c soure files */ #ifndef __RT_DEF_H__ @@ -450,12 +451,6 @@ struct rt_object_information #endif #endif -#ifndef __on_rt_interrupt_enter_hook - #define __on_rt_interrupt_enter_hook() __ON_HOOK_ARGS(rt_interrupt_enter_hook, ()) -#endif -#ifndef __on_rt_interrupt_leave_hook - #define __on_rt_interrupt_leave_hook() __ON_HOOK_ARGS(rt_interrupt_leave_hook, ()) -#endif #ifndef __on_rt_interrupt_switch_hook #define __on_rt_interrupt_switch_hook() __ON_HOOK_ARGS(rt_interrupt_switch_hook, ()) #endif @@ -465,48 +460,7 @@ struct rt_object_information #ifndef __on_rt_free_hook #define __on_rt_free_hook(rmem) __ON_HOOK_ARGS(rt_free_hook, (rmem)) #endif -#ifndef __on_rt_mp_alloc_hook - #define __on_rt_mp_alloc_hook(mp, block) __ON_HOOK_ARGS(rt_mp_alloc_hook, (mp, block)) -#endif -#ifndef __on_rt_mp_free_hook - #define __on_rt_mp_free_hook(mp, block) __ON_HOOK_ARGS(rt_mp_free_hook, (mp, block)) -#endif -#ifndef __on_rt_object_trytake_hook - #define __on_rt_object_trytake_hook(parent) __ON_HOOK_ARGS(rt_object_trytake_hook, (parent)) -#endif -#ifndef __on_rt_object_take_hook - #define __on_rt_object_take_hook(parent) __ON_HOOK_ARGS(rt_object_take_hook, (parent)) -#endif -#ifndef __on_rt_object_put_hook - #define __on_rt_object_put_hook(parent) __ON_HOOK_ARGS(rt_object_put_hook, (parent)) -#endif -#ifndef __on_rt_scheduler_hook - #define __on_rt_scheduler_hook(from, to) __ON_HOOK_ARGS(rt_scheduler_hook, (from, to)) -#endif -#ifndef __on_rt_scheduler_switch_hook - #define __on_rt_scheduler_switch_hook(tid) __ON_HOOK_ARGS(rt_scheduler_switch_hook, (tid)) -#endif -#ifndef __on_rt_object_attach_hook - #define __on_rt_object_attach_hook(obj) __ON_HOOK_ARGS(rt_object_attach_hook, (obj)) -#endif -#ifndef __on_rt_object_detach_hook - #define __on_rt_object_detach_hook(obj) __ON_HOOK_ARGS(rt_object_detach_hook, (obj)) -#endif -#ifndef __on_rt_thread_inited_hook - #define __on_rt_thread_inited_hook(thread) __ON_HOOK_ARGS(rt_thread_inited_hook, (thread)) -#endif -#ifndef __on_rt_thread_suspend_hook - #define __on_rt_thread_suspend_hook(thread) __ON_HOOK_ARGS(rt_thread_suspend_hook, (thread)) -#endif -#ifndef __on_rt_thread_resume_hook - #define __on_rt_thread_resume_hook(thread) __ON_HOOK_ARGS(rt_thread_resume_hook, (thread)) -#endif -#ifndef __on_rt_timer_enter_hook - #define __on_rt_timer_enter_hook(t) __ON_HOOK_ARGS(rt_timer_enter_hook, (t)) -#endif -#ifndef __on_rt_timer_exit_hook - #define __on_rt_timer_exit_hook(t) __ON_HOOK_ARGS(rt_timer_exit_hook, (t)) -#endif + /**@}*/ diff --git a/src/ipc.c b/src/ipc.c index 2853590501..ebcc2780b9 100755 --- a/src/ipc.c +++ b/src/ipc.c @@ -39,12 +39,24 @@ * 2020-10-11 Meco Man add value overflow-check code * 2021-01-03 Meco Man implement rt_mb_urgent() * 2021-05-30 Meco Man implement rt_mutex_trytake() + * 2022-01-07 Gabriel Moving __on_rt_xxxxx_hook to ipc.c */ #include #include -#ifdef RT_USING_HOOK + +#ifndef __on_rt_object_trytake_hook + #define __on_rt_object_trytake_hook(parent) __ON_HOOK_ARGS(rt_object_trytake_hook, (parent)) +#endif +#ifndef __on_rt_object_take_hook + #define __on_rt_object_take_hook(parent) __ON_HOOK_ARGS(rt_object_take_hook, (parent)) +#endif +#ifndef __on_rt_object_put_hook + #define __on_rt_object_put_hook(parent) __ON_HOOK_ARGS(rt_object_put_hook, (parent)) +#endif + +#if defined(RT_USING_HOOK) && defined(RT_HOOK_USING_FUNC_PTR) extern void (*rt_object_trytake_hook)(struct rt_object *object); extern void (*rt_object_take_hook)(struct rt_object *object); extern void (*rt_object_put_hook)(struct rt_object *object); diff --git a/src/irq.c b/src/irq.c index 3889a2a2c8..bc604718b2 100644 --- a/src/irq.c +++ b/src/irq.c @@ -10,12 +10,20 @@ * 2016-08-09 ArdaFu add interrupt enter and leave hook. * 2018-11-22 Jesven rt_interrupt_get_nest function add disable irq * 2021-08-15 Supperthomas fix the comment + * 2022-01-07 Gabriel Moving __on_rt_xxxxx_hook to irq.c */ #include #include -#ifdef RT_USING_HOOK +#ifndef __on_rt_interrupt_enter_hook + #define __on_rt_interrupt_enter_hook() __ON_HOOK_ARGS(rt_interrupt_enter_hook, ()) +#endif +#ifndef __on_rt_interrupt_leave_hook + #define __on_rt_interrupt_leave_hook() __ON_HOOK_ARGS(rt_interrupt_leave_hook, ()) +#endif + +#if defined(RT_USING_HOOK) && defined(RT_HOOK_USING_FUNC_PTR) static void (*rt_interrupt_enter_hook)(void); static void (*rt_interrupt_leave_hook)(void); diff --git a/src/kservice.c b/src/kservice.c index fa0da4c7c4..f49823c2d8 100644 --- a/src/kservice.c +++ b/src/kservice.c @@ -19,6 +19,7 @@ * 2015-07-06 Bernard Add rt_assert_handler routine. * 2021-02-28 Meco Man add RT_KSERVICE_USING_STDLIB * 2021-12-20 Meco Man implement rt_strcpy() + * 2022-01-07 Gabriel add __on_rt_assert_hook */ #include @@ -1741,6 +1742,12 @@ int __rt_ffs(int value) #endif /* RT_USING_TINY_FFS */ #endif /* RT_USING_CPU_FFS */ + +#ifndef __on_rt_assert_hook + #define __on_rt_assert_hook(ex, func, line) __ON_HOOK_ARGS(rt_assert_hook, (ex, func, line)) +#endif + + #ifdef RT_DEBUG /* RT_ASSERT(EX)'s hook */ diff --git a/src/mempool.c b/src/mempool.c index 09a4955eee..ea0ea94cfa 100644 --- a/src/mempool.c +++ b/src/mempool.c @@ -14,6 +14,7 @@ * 2010-10-26 yi.qiu add module support in rt_mp_delete * 2011-01-24 Bernard add object allocation check. * 2012-03-22 Bernard fix align issue in rt_mp_init and rt_mp_create. + * 2022-01-07 Gabriel Moving __on_rt_xxxxx_hook to mempool.c */ #include @@ -21,7 +22,14 @@ #ifdef RT_USING_MEMPOOL -#ifdef RT_USING_HOOK +#ifndef __on_rt_mp_alloc_hook + #define __on_rt_mp_alloc_hook(mp, block) __ON_HOOK_ARGS(rt_mp_alloc_hook, (mp, block)) +#endif +#ifndef __on_rt_mp_free_hook + #define __on_rt_mp_free_hook(mp, block) __ON_HOOK_ARGS(rt_mp_free_hook, (mp, block)) +#endif + +#if defined(RT_USING_HOOK) && defined(RT_HOOK_USING_FUNC_PTR) static void (*rt_mp_alloc_hook)(struct rt_mempool *mp, void *block); static void (*rt_mp_free_hook)(struct rt_mempool *mp, void *block); diff --git a/src/object.c b/src/object.c index 76534f4566..46e53a7f99 100644 --- a/src/object.c +++ b/src/object.c @@ -13,6 +13,7 @@ * 2010-10-26 yi.qiu add module support in rt_object_allocate and rt_object_free * 2017-12-10 Bernard Add object_info enum. * 2018-01-25 Bernard Fix the object find issue when enable MODULE. + * 2022-01-07 Gabriel Moving __on_rt_xxxxx_hook to object.c */ #include @@ -113,7 +114,25 @@ static struct rt_object_information _object_container[RT_Object_Info_Unknown] = #endif }; -#ifdef RT_USING_HOOK + +#ifndef __on_rt_object_attach_hook + #define __on_rt_object_attach_hook(obj) __ON_HOOK_ARGS(rt_object_attach_hook, (obj)) +#endif +#ifndef __on_rt_object_detach_hook + #define __on_rt_object_detach_hook(obj) __ON_HOOK_ARGS(rt_object_detach_hook, (obj)) +#endif +#ifndef __on_rt_object_trytake_hook + #define __on_rt_object_trytake_hook(parent) __ON_HOOK_ARGS(rt_object_trytake_hook, (parent)) +#endif +#ifndef __on_rt_object_take_hook + #define __on_rt_object_take_hook(parent) __ON_HOOK_ARGS(rt_object_take_hook, (parent)) +#endif +#ifndef __on_rt_object_put_hook + #define __on_rt_object_put_hook(parent) __ON_HOOK_ARGS(rt_object_put_hook, (parent)) +#endif + + +#if defined(RT_USING_HOOK) && defined(RT_HOOK_USING_FUNC_PTR) static void (*rt_object_attach_hook)(struct rt_object *object); static void (*rt_object_detach_hook)(struct rt_object *object); void (*rt_object_trytake_hook)(struct rt_object *object); diff --git a/src/scheduler.c b/src/scheduler.c index 6ef02f3d3c..bcc74a2604 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -27,6 +27,7 @@ * rt_schedule_insert_thread won't insert current task to ready queue * in smp version, rt_hw_context_switch_interrupt maybe switch to * new task directly + * 2022-01-07 Gabriel Moving __on_rt_xxxxx_hook to scheduler.c * */ @@ -47,7 +48,14 @@ struct rt_thread *rt_current_thread = RT_NULL; rt_uint8_t rt_current_priority; #endif /* RT_USING_SMP */ -#ifdef RT_USING_HOOK +#ifndef __on_rt_scheduler_hook + #define __on_rt_scheduler_hook(from, to) __ON_HOOK_ARGS(rt_scheduler_hook, (from, to)) +#endif +#ifndef __on_rt_scheduler_switch_hook + #define __on_rt_scheduler_switch_hook(tid) __ON_HOOK_ARGS(rt_scheduler_switch_hook, (tid)) +#endif + +#if defined(RT_USING_HOOK) && defined(RT_HOOK_USING_FUNC_PTR) static void (*rt_scheduler_hook)(struct rt_thread *from, struct rt_thread *to); static void (*rt_scheduler_switch_hook)(struct rt_thread *tid); diff --git a/src/thread.c b/src/thread.c index 090f5f1ef7..a024a3b7dc 100644 --- a/src/thread.c +++ b/src/thread.c @@ -28,13 +28,24 @@ * add support for tasks bound to cpu * 2021-02-24 Meco Man rearrange rt_thread_control() - schedule the thread when close it * 2021-11-15 THEWON Remove duplicate work between idle and _thread_exit + * 2022-01-07 Gabriel Moving __on_rt_xxxxx_hook to thread.c */ #include #include #include -#ifdef RT_USING_HOOK +#ifndef __on_rt_thread_inited_hook + #define __on_rt_thread_inited_hook(thread) __ON_HOOK_ARGS(rt_thread_inited_hook, (thread)) +#endif +#ifndef __on_rt_thread_suspend_hook + #define __on_rt_thread_suspend_hook(thread) __ON_HOOK_ARGS(rt_thread_suspend_hook, (thread)) +#endif +#ifndef __on_rt_thread_resume_hook + #define __on_rt_thread_resume_hook(thread) __ON_HOOK_ARGS(rt_thread_resume_hook, (thread)) +#endif + +#if defined(RT_USING_HOOK) && defined(RT_HOOK_USING_FUNC_PTR) static void (*rt_thread_suspend_hook)(rt_thread_t thread); static void (*rt_thread_resume_hook) (rt_thread_t thread); static void (*rt_thread_inited_hook) (rt_thread_t thread); diff --git a/src/timer.c b/src/timer.c index 846c33263b..da113298da 100644 --- a/src/timer.c +++ b/src/timer.c @@ -17,6 +17,7 @@ * 2014-07-12 Bernard does not lock scheduler when invoking soft-timer * timeout function. * 2021-08-15 supperthomas add the comment + * 2022-01-07 Gabriel Moving __on_rt_xxxxx_hook to timer.c */ #include @@ -47,7 +48,20 @@ ALIGN(RT_ALIGN_SIZE) static rt_uint8_t _timer_thread_stack[RT_TIMER_THREAD_STACK_SIZE]; #endif /* RT_USING_TIMER_SOFT */ -#ifdef RT_USING_HOOK +#ifndef __on_rt_object_take_hook + #define __on_rt_object_take_hook(parent) __ON_HOOK_ARGS(rt_object_take_hook, (parent)) +#endif +#ifndef __on_rt_object_put_hook + #define __on_rt_object_put_hook(parent) __ON_HOOK_ARGS(rt_object_put_hook, (parent)) +#endif +#ifndef __on_rt_timer_enter_hook + #define __on_rt_timer_enter_hook(t) __ON_HOOK_ARGS(rt_timer_enter_hook, (t)) +#endif +#ifndef __on_rt_timer_exit_hook + #define __on_rt_timer_exit_hook(t) __ON_HOOK_ARGS(rt_timer_exit_hook, (t)) +#endif + +#if defined(RT_USING_HOOK) && defined(RT_HOOK_USING_FUNC_PTR) extern void (*rt_object_take_hook)(struct rt_object *object); extern void (*rt_object_put_hook)(struct rt_object *object); static void (*rt_timer_enter_hook)(struct rt_timer *timer); -- cgit v1.3.1 From 09f439bcc2fbe574dd619fcb97b617912dde63a6 Mon Sep 17 00:00:00 2001 From: tangyuxin <462747508@qq.com> Date: Sat, 1 Jan 2022 19:13:13 +0800 Subject: [memheap] Fix 64 bit potential risk --- components/finsh/msh.c | 2 +- include/rtdef.h | 6 +++--- include/rtthread.h | 12 +++++------ src/kservice.c | 6 +++--- src/memheap.c | 54 ++++++++++++++++++++++++++++---------------------- 5 files changed, 43 insertions(+), 37 deletions(-) (limited to 'include') diff --git a/components/finsh/msh.c b/components/finsh/msh.c index 47ee1efa59..27e937f750 100644 --- a/components/finsh/msh.c +++ b/components/finsh/msh.c @@ -71,7 +71,7 @@ MSH_CMD_EXPORT_ALIAS(cmd_ps, ps, List threads in the system.); #ifdef RT_USING_HEAP int cmd_free(int argc, char **argv) { - rt_uint32_t total = 0, used = 0, max_used = 0; + rt_size_t total = 0, used = 0, max_used = 0; rt_memory_info(&total, &used, &max_used); rt_kprintf("total : %d\n", total); diff --git a/include/rtdef.h b/include/rtdef.h index a018ceb21d..6d47d18a2c 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -927,9 +927,9 @@ struct rt_memheap void *start_addr; /**< pool start address and size */ - rt_uint32_t pool_size; /**< pool size */ - rt_uint32_t available_size; /**< available size */ - rt_uint32_t max_used_size; /**< maximum allocated size */ + rt_size_t pool_size; /**< pool size */ + rt_size_t available_size; /**< available size */ + rt_size_t max_used_size; /**< maximum allocated size */ struct rt_memheap_item *block_list; /**< used block list */ diff --git a/include/rtthread.h b/include/rtthread.h index 120f565f3e..4d4c93fd5e 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -266,9 +266,9 @@ void *rt_calloc(rt_size_t count, rt_size_t size); void *rt_malloc_align(rt_size_t size, rt_size_t align); void rt_free_align(void *ptr); -void rt_memory_info(rt_uint32_t *total, - rt_uint32_t *used, - rt_uint32_t *max_used); +void rt_memory_info(rt_size_t *total, + rt_size_t *used, + rt_size_t *max_used); #if defined(RT_USING_SLAB) && defined(RT_USING_SLAB_AS_HEAP) void *rt_page_alloc(rt_size_t npages); @@ -308,9 +308,9 @@ void *rt_memheap_alloc(struct rt_memheap *heap, rt_size_t size); void *rt_memheap_realloc(struct rt_memheap *heap, void *ptr, rt_size_t newsize); void rt_memheap_free(void *ptr); void rt_memheap_info(struct rt_memheap *heap, - rt_uint32_t *total, - rt_uint32_t *used, - rt_uint32_t *max_used); + rt_size_t *total, + rt_size_t *used, + rt_size_t *max_used); #endif #ifdef RT_USING_SLAB diff --git a/src/kservice.c b/src/kservice.c index fa0da4c7c4..ca4fb9c088 100644 --- a/src/kservice.c +++ b/src/kservice.c @@ -1558,9 +1558,9 @@ RTM_EXPORT(rt_free); * * @param max_used is a pointer to get the maximum memory used. */ -RT_WEAK void rt_memory_info(rt_uint32_t *total, - rt_uint32_t *used, - rt_uint32_t *max_used) +RT_WEAK void rt_memory_info(rt_size_t *total, + rt_size_t *used, + rt_size_t *max_used) { rt_base_t level; diff --git a/src/memheap.c b/src/memheap.c index 62b42f73ed..71e43580f4 100644 --- a/src/memheap.c +++ b/src/memheap.c @@ -27,7 +27,7 @@ /* dynamic pool magic and mask */ #define RT_MEMHEAP_MAGIC 0x1ea01ea0 -#define RT_MEMHEAP_MASK 0xfffffffe +#define RT_MEMHEAP_MASK 0xFFFFFFFE #define RT_MEMHEAP_USED 0x01 #define RT_MEMHEAP_FREED 0x00 @@ -38,6 +38,16 @@ #define MEMITEM_SIZE(item) ((rt_ubase_t)item->next - (rt_ubase_t)item - RT_MEMHEAP_SIZE) #define MEMITEM(ptr) (struct rt_memheap_item*)((rt_uint8_t*)ptr - RT_MEMHEAP_SIZE) +static void _remove_next_ptr(struct rt_memheap_item *next_ptr) +{ + /* Fix the crash problem after opening Oz optimization on ac6 */ + /* Fix IAR compiler warning */ + next_ptr->next_free->prev_free = next_ptr->prev_free; + next_ptr->prev_free->next_free = next_ptr->next_free; + next_ptr->next->prev = next_ptr->prev; + next_ptr->prev->next = next_ptr->next; +} + /** * @brief This function initializes a piece of memory called memheap. * @@ -173,7 +183,7 @@ RTM_EXPORT(rt_memheap_detach); void *rt_memheap_alloc(struct rt_memheap *heap, rt_size_t size) { rt_err_t result; - rt_uint32_t free_size; + rt_size_t free_size; struct rt_memheap_item *header_ptr; RT_ASSERT(heap != RT_NULL); @@ -382,8 +392,7 @@ void *rt_memheap_realloc(struct rt_memheap *heap, void *ptr, rt_size_t newsize) if (newsize > oldsize) { void *new_ptr; - /* Fix the crash problem after opening Oz optimization on ac6 */ - volatile struct rt_memheap_item *next_ptr; + struct rt_memheap_item *next_ptr; if (heap->locked == RT_FALSE) { @@ -432,10 +441,7 @@ void *rt_memheap_realloc(struct rt_memheap *heap, void *ptr, rt_size_t newsize) next_ptr->next_free, next_ptr->prev_free)); - next_ptr->next_free->prev_free = next_ptr->prev_free; - next_ptr->prev_free->next_free = next_ptr->next_free; - next_ptr->next->prev = next_ptr->prev; - next_ptr->prev->next = next_ptr->next; + _remove_next_ptr(next_ptr); /* build a new one on the right place */ next_ptr = (struct rt_memheap_item *)((char *)ptr + newsize); @@ -593,13 +599,13 @@ void rt_memheap_free(void *ptr) rt_err_t result; struct rt_memheap *heap; struct rt_memheap_item *header_ptr, *new_ptr; - rt_uint32_t insert_header; + rt_bool_t insert_header; /* NULL check */ if (ptr == RT_NULL) return; /* set initial status as OK */ - insert_header = 1; + insert_header = RT_TRUE; new_ptr = RT_NULL; header_ptr = (struct rt_memheap_item *) ((rt_uint8_t *)ptr - RT_MEMHEAP_SIZE); @@ -657,7 +663,7 @@ void rt_memheap_free(void *ptr) /* move header pointer to previous. */ header_ptr = header_ptr->prev; /* don't insert header to free list */ - insert_header = 0; + insert_header = RT_FALSE; } /* determine if the block can be merged with the next neighbor. */ @@ -685,10 +691,10 @@ void rt_memheap_free(void *ptr) { struct rt_memheap_item *n = heap->free_list->next_free;; #if defined(RT_MEMHEAP_BSET_MODE) - rt_uint32_t blk_size = MEMITEM_SIZE(header_ptr); + rt_size_t blk_size = MEMITEM_SIZE(header_ptr); for (;n != heap->free_list; n = n->next_free) { - rt_uint32_t m = MEMITEM_SIZE(n); + rt_size_t m = MEMITEM_SIZE(n); if (blk_size <= m) { break; @@ -732,9 +738,9 @@ RTM_EXPORT(rt_memheap_free); * @param max_used is a pointer to get the maximum memory used. */ void rt_memheap_info(struct rt_memheap *heap, - rt_uint32_t *total, - rt_uint32_t *used, - rt_uint32_t *max_used) + rt_size_t *total, + rt_size_t *used, + rt_size_t *max_used) { rt_err_t result; @@ -898,10 +904,10 @@ int memheapcheck(int argc, char *argv[]) break; } /* check next and prev */ - if (!((rt_uint32_t)item->next <= (rt_uint32_t)((rt_uint32_t)heap->start_addr + heap->pool_size) && - (rt_uint32_t)item->prev >= (rt_uint32_t)heap->start_addr) && - (rt_uint32_t)item->next == RT_ALIGN((rt_uint32_t)item->next, RT_ALIGN_SIZE) && - (rt_uint32_t)item->prev == RT_ALIGN((rt_uint32_t)item->prev, RT_ALIGN_SIZE)) + if (!((rt_ubase_t)item->next <= (rt_ubase_t)((rt_ubase_t)heap->start_addr + heap->pool_size) && + (rt_ubase_t)item->prev >= (rt_ubase_t)heap->start_addr) && + (rt_ubase_t)item->next == RT_ALIGN((rt_ubase_t)item->next, RT_ALIGN_SIZE) && + (rt_ubase_t)item->prev == RT_ALIGN((rt_ubase_t)item->prev, RT_ALIGN_SIZE)) { has_bad = RT_TRUE; break; @@ -919,7 +925,7 @@ int memheapcheck(int argc, char *argv[]) { rt_kprintf("Memory block wrong:\n"); rt_kprintf("name: %s\n", heap->parent.name); - rt_kprintf("item: 0x%08x\n", item); + rt_kprintf("item: 0x%p\n", item); } return 0; } @@ -948,7 +954,7 @@ int memheaptrace(int argc, char *argv[]) /* memheap dump */ rt_kprintf("\nmemory heap address:\n"); rt_kprintf("name : %s\n", mh->parent.name); - rt_kprintf("heap_ptr: 0x%08x\n", mh->start_addr); + rt_kprintf("heap_ptr: 0x%p\n", mh->start_addr); rt_kprintf("free : 0x%08x\n", mh->available_size); rt_kprintf("max_used: 0x%08x\n", mh->max_used_size); rt_kprintf("size : 0x%08x\n", mh->pool_size); @@ -960,7 +966,7 @@ int memheaptrace(int argc, char *argv[]) { if ((header_ptr->magic & RT_MEMHEAP_MASK) != RT_MEMHEAP_MAGIC) { - rt_kprintf("[0x%08x - incorrect magic: 0x%08x\n", + rt_kprintf("[0x%p - incorrect magic: 0x%08x\n", header_ptr, header_ptr->magic); break; } @@ -969,7 +975,7 @@ int memheaptrace(int argc, char *argv[]) if (block_size < 0) break; - rt_kprintf("[0x%08x - ", header_ptr); + rt_kprintf("[0x%p - ", header_ptr); if (block_size < 1024) rt_kprintf("%5d", block_size); else if (block_size < 1024 * 1024) -- cgit v1.3.1 From dd62b2b10671c2b141ef75b848467d8351b5bfee Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Wed, 5 Jan 2022 12:06:34 -0500 Subject: [kservice] 增加RT_KSERVICE_USING_STDLIB_MEMSET RT_KSERVICE_USING_STDLIB_MEMCPY MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/rtthread.h | 10 ++++++++++ src/Kconfig | 10 ++++++++++ src/kservice.c | 4 ++++ 3 files changed, 24 insertions(+) (limited to 'include') diff --git a/include/rtthread.h b/include/rtthread.h index 4d4c93fd5e..45a7655be9 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -596,8 +596,12 @@ int *_rt_errno(void); int __rt_ffs(int value); +#ifndef RT_KSERVICE_USING_STDLIB_MEMSET void *rt_memset(void *src, int c, rt_ubase_t n); +#endif /* RT_KSERVICE_USING_STDLIB_MEMSET */ +#ifndef RT_KSERVICE_USING_STDLIB_MEMCPY void *rt_memcpy(void *dest, const void *src, rt_ubase_t n); +#endif /* RT_KSERVICE_USING_STDLIB_MEMCPY */ char *rt_strdup(const char *s); #ifndef RT_KSERVICE_USING_STDLIB @@ -612,6 +616,12 @@ rt_int32_t rt_strcmp(const char *cs, const char *ct); rt_size_t rt_strlen(const char *src); #else #include +#ifdef RT_KSERVICE_USING_STDLIB_MEMSET +#define rt_memset(s, c, count) memset(s, c, count) +#endif /* RT_KSERVICE_USING_STDLIB_MEMSET */ +#ifdef RT_KSERVICE_USING_STDLIB_MEMCPY +#define rt_memcpy(dst, src, count) memcpy(dst, src, count) +#endif /* RT_KSERVICE_USING_STDLIB_MEMCPY */ #define rt_memmove(dest, src, n) memmove(dest, src, n) #define rt_memcmp(cs, ct, count) memcmp(cs, ct, count) #define rt_strstr(str1, str2) strstr(str1, str2) diff --git a/src/Kconfig b/src/Kconfig index dda7f08032..69edd20641 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -135,6 +135,16 @@ menu "kservice optimization" bool "Enable kservice to use standard C library" default n + if RT_KSERVICE_USING_STDLIB + config RT_KSERVICE_USING_STDLIB_MEMCPY + bool "Use memcpy to replace rt_memcpy (faster, but not safe)" + default n + + config RT_KSERVICE_USING_STDLIB_MEMSET + bool "Use memset to replace rt_memset (faster, but not safe)" + default n + endif + config RT_KSERVICE_USING_TINY_SIZE bool "Enable kservice to use tiny size" default n diff --git a/src/kservice.c b/src/kservice.c index ca4fb9c088..459109ce75 100644 --- a/src/kservice.c +++ b/src/kservice.c @@ -116,6 +116,7 @@ int *_rt_errno(void) } RTM_EXPORT(_rt_errno); +#ifndef RT_KSERVICE_USING_STDLIB_MEMSET /** * This function will set the content of memory to specified value. * @@ -201,7 +202,9 @@ RT_WEAK void *rt_memset(void *s, int c, rt_ubase_t count) #endif /* RT_KSERVICE_USING_TINY_SIZE */ } RTM_EXPORT(rt_memset); +#endif /* RT_KSERVICE_USING_STDLIB_MEMSET */ +#ifndef RT_KSERVICE_USING_STDLIB_MEMCPY /** * This function will copy memory content from source address to destination address. * @@ -285,6 +288,7 @@ RT_WEAK void *rt_memcpy(void *dst, const void *src, rt_ubase_t count) #endif /* RT_KSERVICE_USING_TINY_SIZE */ } RTM_EXPORT(rt_memcpy); +#endif /* RT_KSERVICE_USING_STDLIB_MEMCPY */ #ifndef RT_KSERVICE_USING_STDLIB -- cgit v1.3.1