Keil5编译报错:Error: L6218E: Undefined symbol __use_two_region_memory (referred from startup_stm32wle5xx

Error: L6218E: Undefined symbol 系列错误汇总 (referred from main.o) 函数在main中调用了,但确找不到这个符号,因此该文件中会出现函数右键无法跳转、无代码提示,因为bsp_led.c这个文件压根没出现在工程中。:因为忘记添加 bsp_led.c了!就那么狗血的问题困扰我半小时!中的函数无法跳转、也没有代码提示。望广大码友引以为戒, 别像我一样犯那么低级的错误。文件, 结果总是出现以下错误,类似问题会持续更新在这篇博客里。 阅读详情

1. 问题初探:当MicroLIB遇上STM32WLE5

最近在折腾一块STM32WLE5系列的开发板,用Keil MDK-ARM(也就是大家常说的Keil5)做开发。项目本身不算复杂,但为了优化代码体积,我像往常一样,在项目的“魔术棒”选项(Options for Target)里,勾选了那个熟悉的“Use MicroLIB”选项。心里想着,MicroLIB是ARM提供的精简C库,能省下不少Flash空间,对于资源紧张的嵌入式项目来说,是个常规操作。

结果一编译,熟悉的“Build Output”窗口立刻给我泼了盆冷水,弹出来两个链接错误(Linking... Error):

Error: L6218E: Undefined symbol __use_two_region_memory (referred from startup_stm32wle5xx.o).
Error: L6218E: Undefined symbol __initial_sp (referred from entry2.o).

看到这个报错,估计不少朋友都跟我当时一样,有点懵。__initial_sp这个符号还算眼熟,它跟堆栈指针初始化有关。但前面那个__use_two_region_memory是啥?字面意思是“使用两区内存”,听起来就很底层。而且错误提示明确指出,这两个符号分别被启动文件startup_stm32wle5xx.o和某个entry2.o文件引用了,但现在链接器(Linker)在它搜索的所有库和目标文件里,就是找不到它们的定义(Undefined symbol)。

这其实是一个经典的“配置冲突”问题。简单来说,你告诉编译器:“我要用MicroLIB这个精简库”,但你的项目文件(特别是芯片的启动文件)可能是在为标准C库(ARM Compiler默认的完整库)的环境下编写的。两者对内存如何初始化、堆(Heap)和栈(Stack)怎么布局的“约定”不一样,于是就“吵起来了”,链接器自然就报错了。尤其是STM32WLE5这类较新或特定系列的芯片,其官方提供的启动文件套件,可能默认适配的是标准库环境,当你切换库时,问题就暴露了出来。接下来,我们就得深入这两个符号的背后,看看它们到底代表了什么,以及如何让MicroLIB和你的启动文件“握手言和”。

2. 深入原理:内存模型与库的“分歧”

要彻底解决这个错误,我们不能停留在表面去盲目尝试各种“偏方”,得理解这两个符号到底在系统中扮演什么角色。这涉及到嵌入式C程序启动时最核心的环节之一:内存的初始化。

2.1 __use_two_region_memory:堆与栈的“分家”协议

首先来看__use_two_region_memory。这个符号的名字直译过来就是“使用两个区域的内存”。在ARM Cortex-M内核的嵌入式系统中,程序可用的RAM(随机存取存储器)通常被规划为几个部分,其中最重要的两个就是堆(Heap)和栈(Stack)。

你可以把整个RAM想象成一个大仓库。栈就像是一个严格按照“后进先出”规则摆放的货架,主要用来存放函数调用时的局部变量、函数参数、返回地址等。它的增长方向通常是向下的(从高地址向低地址)。堆则像是仓库里一片可以自由申请和释放的散货区,主要用于动态内存分配(比如malloc、calloc等函数)。它的增长方向通常是向上的(从低地址向高地址)。

那么问题来了,如果堆和栈都在同一个仓库

stm32学习笔记-启动文件 1、配置栈 Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp EQU:相当于C中的define,定义Stack_Size = 0x00000400。 AREA: 指... 阅读详情

相关推荐

Keil启用Use MicroLIB编译报错:深入解析__use_two_region_memory与__initial_sp的符号定义冲突

本文深入解析Keil启用Use MicroLIB编译时出现__use_two_region_memory与__initial_sp符号定义冲突的报错原因。通过剖析MicroLIB与标准库的内存模型差异,提供多种解决方案,包括修改启动文件属性、手动添加符号定义等,帮助开发者快速解决Undefined symbol错误,确保项目顺利编译。

vv45678的博客 1033

keil 5 : Error: L6218E: Undefined symbol 问题解决方法小记

最近学习嵌入式开发,因项目框架较大,部分内容改动,在将别人单独写的串口读取数据源码添加到工程中后,编译出现以下问题: 通过查询资料,都是在说未定义引下的错误。 回头检查项目,源文件加入到工程,头文件也已包含。而后多次尝试编译,未果;关闭重启,亦未果。。。 询求正点原子技术支持,远程协助,还是未能解决。。。 编译通不过,调试无法进行,苦恼一天。。。。 后来,多次将源文件多项目中删除后重...

zhizuwei的专栏 16万+

STM32在Keil调试时能成功运行但下载就运行不了的问题

记得之前在STM32上做串口终端的时候图方便,想用C库里的 printf() ,于是重载了 putc(),也在 keil 的项目配置中勾选了 Use MicroLIB 选项。但是程序下载到STM32上之后,串口却一点反应也没有,我先是检查了时钟、GPIO配置和串口使能,发现都没问题。而且调试的时候程序正常运行,串口也正常输出。后来发现程序在调试的时候总是会在停在 BKPT 0xAB 指令处,但它又不属于用户代码,因此意识到是标准库的问题(准确来说是我自己的问题)。最后发现要使用 printf() 重载的是.

qq_49520586的博客 1万+

关于解决工程编译出现Undefined symbol __use_two_region_memory 和Undefined symbol __initial_sp的问题

开发环境:KEIL MDK 5.23 MCU型号:MAX32630 在编译工程文件是,出现Undefined symbol __use_two_region_memory 和Undefined symbol __initial_sp,如下图所示 知其然就要知其所以然,我们先来了解一下 __use_two_region_memory是什么东西吧。 use_two_region_mem

Justice Gao 1万+

在Window上安装和配置VTK9.x,并在QT项目中调试VTK是否可用

VTK+MSVC+Qt Creator + CMake配置

qq_42279379的博客 1000

用Multisim和AD2复刻经典:手把手教你搭建μA741三角波-方波发生器(附完整避坑指南)

本文详细介绍了如何使用Multisim和AD2搭建基于μA741运算放大器的三角波-方波发生器,包括电路原理、Multisim仿真流程、AD2硬件搭建及调试技巧。通过对比理论计算、仿真和实测数据,深入分析器件非理想特性的影响,并提供16个典型问题的解决方案,帮助读者掌握波形发生器的设计原理和工程调试经验。

weixin_28744423的博客 286

ue4 角色奔跑/冲刺/蹲下 /蹲走 动作切换蓝图

序列:文章分为4部分: 一、准备工作+简单的蓝图连线 二、编写“行走” 混合空间 三、编写“蹲下”混合空间 四、合成2个动画,设置动画蓝图 —————————————— 一、准备工作 下载“动画初学者包”,添加到项目! 主要文件: 打开BP_playerCharacter,组价——添加组件,找到“摄像机”,“机臂” 没有找到就去其他项目复制过来 ———————————— 手写人物的移动,也可以在...

凉城古梦猫扑街的博客 4865

机器学习预测土壤养分:从电导率、pH到随机森林与神经网络的农业实践

在智慧农业与精准农业领域,机器学习已成为处理复杂农业数据、挖掘潜在规律的关键技术。其核心原理在于通过算法从多维数据中自动学习特征与目标变量之间的映射关系,尤其擅长捕捉非线性关联。这项技术的核心价值在于能够将传统上依赖昂贵、耗时实验室分析的问题(如土壤养分检测),转化为基于易获取传感器数据(如电导率、pH值)的快速、低成本预测任务,为农业生产的实时决策与资源优化提供了全新可能。其典型应用场景包括作物生长监测、产量预测以及精准施肥管理等。本文聚焦于利用随机森林和神经网络等回归算法,构建通过土壤物理参数预测氮磷钾

weixin_33693070的博客 670

【openEuler容器镜像部署指南】

【代码】【List集合排序 】

weixin_43878094的博客 1113

华为OD机试 - 素数之积 - 数学问题(Java 2025 A卷 100分)

每一题都有详细的答题思路、详细的代码注释、样例测试,发现新题目,随时更新,全天优快云在线答疑。

学Java,找哪吒 2134

【论文精读】Graph WaveNet-深度时空图模型

Graph WaveNet构建了一个自适应邻接矩阵,它能保留隐藏的空间依赖关系,能够自动从数据中发现未见的图结构。提出了一个有效且高效的框架,可同时捕捉空间和时间依赖关系。其核心思想是将其提出的图卷积与扩张因果卷积相结合,使每个图卷积层都能处理空间依赖关系。在交通数据集上评估了提出的模型,并以较低的计算成本获得了最先进的结果。

打酱油的葫芦娃 1010

OCR文字识别基础

ocr文字识别

m0_47405013的博客 1755

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

上一篇: 从理论到实践:双差速小车模型的运动学与动力学全解析
下一篇: DVWA靶机实战:Vega工具在Web漏洞扫描中的高效应用
bread
博客等级 码龄26年 60粉丝 1210原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值