diff --git a/bsp/simulator/applications/dfs_win32.c b/bsp/simulator/applications/dfs_win32.c index 1ed671f781672bf2efb9c4227687c0dbe7d9712e..605d6533b489d8e82e4cf0bf39b2aea4cd159aa9 100644 --- a/bsp/simulator/applications/dfs_win32.c +++ b/bsp/simulator/applications/dfs_win32.c @@ -80,7 +80,6 @@ static int win32_result_to_dfs(DWORD res) /* unknown error */ rt_kprintf("dfs win32 error not supported yet: %d\n", res); return -1; - } static int dfs_win32_mount( diff --git a/bsp/simulator/applications/startup.c b/bsp/simulator/applications/startup.c index 2056d5afb23b495093e3f360e0c5b1b50df818e0..fd46980b42875929dd238e237a6ff9546486d8bf 100644 --- a/bsp/simulator/applications/startup.c +++ b/bsp/simulator/applications/startup.c @@ -52,7 +52,7 @@ void rtthread_startup(void) #ifdef RT_USING_HEAP /* init memory system */ - rt_system_heap_init((void *)heap, (void *)&heap[HEAP_SIZE - 1]); + rt_system_heap_init((void *)heap, (void *)&heap[RT_HEAP_SIZE - 1]); #endif /* init scheduler system */ diff --git a/bsp/simulator/drivers/board.c b/bsp/simulator/drivers/board.c index d85f5945f2d5e753f7293e55c537fa5f59a505ed..079071cb6e75907a4a6e83942cbe44052250d838 100644 --- a/bsp/simulator/drivers/board.c +++ b/bsp/simulator/drivers/board.c @@ -26,7 +26,7 @@ rt_uint8_t *heap; rt_uint8_t *rt_hw_sram_init(void) { rt_uint8_t *heap; - heap = malloc(HEAP_SIZE); + heap = malloc(RT_HEAP_SIZE); if (heap == RT_NULL) { rt_kprintf("there is no memory in pc."); diff --git a/bsp/simulator/drivers/sst25vfxx_mtd_sim.c b/bsp/simulator/drivers/sst25vfxx_mtd_sim.c index 315cdf665bc27d2a25ce00d7e3c7fd37cd8e4001..2c1e5a9dc23c5305541669a489d4b635f7303a22 100644 --- a/bsp/simulator/drivers/sst25vfxx_mtd_sim.c +++ b/bsp/simulator/drivers/sst25vfxx_mtd_sim.c @@ -90,8 +90,7 @@ static int sst25vfxx_write(struct rt_mtd_nor_device *device, rt_off_t position, } static char block_buffer[BLOCK_SIZE]; - -static rt_err_t sst25vfxx_erase_block(struct rt_mtd_nor_device *device, rt_uint32_t block) +static rt_err_t sst25vfxx_erase_block(struct rt_mtd_nor_device *device, rt_off_t offset, rt_uint32_t length) { struct sst25_mtd *sst25; int result; @@ -103,7 +102,7 @@ static rt_err_t sst25vfxx_erase_block(struct rt_mtd_nor_device *device, rt_uint3 rt_mutex_take(&flash_lock, RT_WAITING_FOREVER); memset(block_buffer, 0xFF, BLOCK_SIZE); - fseek(sst25->file, block, SEEK_SET); + fseek(sst25->file, offset, SEEK_SET); result = fwrite(block_buffer, BLOCK_SIZE, 1, sst25->file); if (result < 0) @@ -186,7 +185,7 @@ rt_err_t sst25vfxx_mtd_init(const char *nor_name, sst25->file = fopen(NOR_SIM, "rb+"); if (sst25->file == NULL) { - int i; + rt_uint32_t i; /* create a file to simulate nor */ sst25->file = fopen(NOR_SIM, "wb+"); @@ -216,10 +215,10 @@ void nor_erase(void) rt_uint32_t index; struct rt_mtd_nor_device *mtd; - mtd = SST25_MTD(&_sst25_mtd); + mtd = RT_MTD_NOR_DEVICE(&_sst25_mtd); for (index = mtd->block_start; index < mtd->block_end; index ++) { - sst25vfxx_erase_block(mtd, index * mtd->block_size); + sst25vfxx_erase_block(mtd, index * mtd->block_size, BLOCK_SIZE); } } FINSH_FUNCTION_EXPORT(nor_erase, erase all block in SPI flash); diff --git a/bsp/simulator/rtconfig.h b/bsp/simulator/rtconfig.h index ef5a43ea20742c239322b56e10df98336d08c7c4..38ea44beebe78a66354dd5d2ecbe5ccf211e573f 100644 --- a/bsp/simulator/rtconfig.h +++ b/bsp/simulator/rtconfig.h @@ -9,7 +9,7 @@ #define NORESOURCE //RT_VESRION in winuser.h #define _CRT_ERRNO_DEFINED //errno macro redefinition -#define HEAP_SIZE (1024*1024*2) +#define RT_HEAP_SIZE (1024*1024*2) /* disable some warning in MSC */ #pragma warning(disable:4273) /* to ignore: warning C4273: inconsistent dll linkage */ diff --git a/bsp/simulator/rtgui_demo/snake/snake_gui.c b/bsp/simulator/rtgui_demo/snake/snake_gui.c index e369feccaa3461867ca361b1664f1a596cd9757b..c25e94c4eef1cb1803fb709cc89f977cd398b92e 100644 --- a/bsp/simulator/rtgui_demo/snake/snake_gui.c +++ b/bsp/simulator/rtgui_demo/snake/snake_gui.c @@ -17,7 +17,6 @@ #define SNAKE_HEAD_COLOR RTGUI_RGB(180, 70, 130) #define BACKGROUND_COLOR RTGUI_RGB(153, 153, 0) #define FOOD_COLOR RTGUI_RGB(128, 0, 0) -#define min(a, b) ((a) < (b) ? (a) : (b)) static rtgui_timer_t *timer; static rt_size_t room_size_x, room_size_y; @@ -153,7 +152,7 @@ static void snake_draw(struct rtgui_widget *widget) /* draw snake. */ { - rt_uint32_t x, y; + rt_int32_t x, y; rt_bool_t first_node = RT_TRUE; for (y = 0; y < map->height; y++)