关于烧录后配置没改变

Viewed 24

复现步骤


我对源码改了一些内容,make正常运行,但是启动开发板后还是之前的配置怎么回事,比如:1:我按照教程,image.png,更改了自启动程序,从自启动人脸识别为开机显示图片,但是烧录后还是人脸识别;在比如:我按照教程写了drv_hello.c驱动文件,output目录下也能找到.o文件,但是烧录后没有该驱动
/*

  • Copyright (c) 2006-2018, RT-Thread Development Team
  • SPDX-License-Identifier: Apache-2.0
  • Change Logs:
  • Date Author Notes
  • 2018-12-05 zylx first version
  • 2018-12-12 greedyhao Porting for stm32f7xx
  • 2019-02-01 yuneizhilin fix the stm32_adc_init function initialization issue
  • 2024-12-02 100askteam add rt_size_t hello_read
    */
    #include<board.h>
    #include<rtthread.h>
    #include<rtdevice.h>
    #include<string.h>

//#define DRV_DEBUG
#define LOG_TAG "drv.hello"
//#include <drv_log.h>

static struct rt_device hello_drv;

static rt_size_t hello_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
{
rt_kprintf("==========hello====================");
// 简单地返回一个固定字符串到缓冲区
const char *response = "Hello from read!\n\r";
rt_size_t len = strlen(response);

// 确保不会超出缓冲区大小
if (size < len)
{
len = size;
}

// 复制字符串到缓冲区
memcpy(buffer, response, len);

return len;
}

static rt_size_t hello_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size)
{
const int *tmp = buffer;
if (tmp[0] == 1)
rt_kprintf("Hello, sam\n\r");
else if (tmp[0] == 0)
rt_kprintf("Bye, sam\n\r");
else
rt_kprintf("Invalid\n\r");
return size;
}

#ifdef RT_USING_DEVICE_OPS
const static struct rt_device_ops hello_ops =
{
RT_NULL,
RT_NULL,
RT_NULL,
hello_read,
hello_write,
RT_NULL,
};
#endif

static int hello_drv_init(void)
{
int ret;

/* 分配一个 rt_device /
/
设置 */
hello_drv.type = RT_Device_Class_Miscellaneous;
hello_drv.rx_indicate = RT_NULL;
hello_drv.tx_complete = RT_NULL;

#ifdef RT_USING_DEVICE_OPS
hello_drv.ops = &hello_ops;
#else
hello_drv.init = RT_NULL;
hello_drv.open = RT_NULL;
hello_drv.close = RT_NULL;
hello_drv.read = hello_read;
hello_drv.write = hello_write;
hello_drv.control = RT_NULL;
#endif

/* 注册 */
ret = rt_device_register(&hello_drv, "hello", RT_DEVICE_FLAG_RDWR);
rt_kprintf("rt_device_register hello, ret = %d\n", ret);

return ret;
}

INIT_BOARD_EXPORT(hello_drv_init);

硬件板卡


rt-smart ai学习套件

软件版本


k230_canmv_dongshanpi_sdcard__nncase_v2.9.0

1 Answers

修改后编译了吗?用的那个命令编译的? 修改完后需要make;