Common command functions in startup.s files in STM32 development

Due to the popularity of C and the development of compilers, more and more software engineers seldom have access to assembly language in programming. In the development of ARM, we will inevitably encounter the compilation of startup file. In KEIL environment, startup. s file is generally used as startup code.Many engineers have a headache when they see this file. Here I will briefly introduce some common assembly instructions and pseudo-instructions. I hope it will be helpful to you. Next time I see the. s file, I will not find it so difficult to accept.   Remind you, in assembly code is not...

design_model(12)chain

1.Responsibility chain mode Avoid the coupling relationship between the sender and the receiver of the request. 2.Example public interface Leader { public abstract void leave(Apply apl); } public class Manager implements Leader { private Leader leader; public void leave(Apply apply) { if(apply.getI()>5) { System.out.println("The manager agrees.Leader.leave (apply);}else {System.out.println ("manager agrees");}}Public Leader getLeader () {Return leader;}Public void setLeader (Leader leader) {This.leader = leader;}}Public class Major implements Lea...

File related operations

#Non text files, using Rb, upload and download are binary, UTF-8, GBK form RB# f = open('f:\\123.txt', mode="rb",)# content = f.read()# f.write("you ae".encode("utf-8"))# print(content)# print(f)# f.close()#bypes ---------> str R# f = open("123", mode="r", encoding="utf-8")## content = f.read()## print(content,type(content))# print(f,type(f))# f.close()#W----> no file-->build have file-->first delete all content and then write# f = open("log", mode="w", encoding="utf-8")# f.write("can you understand")# f.close()# WB# f = open("log", mode="wb")# f.write("123".encode("utf-8"))# f....

Set operation correlation

#set -------> set# str# lis = [11,2,3,4]## for i in range(len(lis)):# print(i)## del lis[i]# print(lis)# # print(lis)# lis = [11,22,33,44]## for i in range(len(lis)):# lis.pop()## print(lis)# l1 = [11,22]# l2 = l1# l3 = l2# l3.append("a")# print(l1)# print(l2)# print(l3)dic = {"k1":"v1", "k2":"v2", "a3":"v3"}dic1 = {}# for i in dic:# if "k" not in i:# dic1.setdefault(i, dic[i])## dic = dic1# print(dic)## l = []## for i in dic:# if "k" in i:# l.append(i)# for i in l:# if i in dic:# del dic[i]## print(dic)#0 '' [] () {} set() ----> bo...

The art of concurrent programming for Java (notes)

Threads have overhead time for creation and context switching, and all single-threaded programs are not necessarily slower than multithreaded execution times. (the shorter the execution time is, the more obvious it is).     In imperative programming, there are two communication mechanisms between threads: shared memory and message passing. In shared memory concurrency model, threads share common status. In message passing concurrency model, messages must be displayed between threads. Synchronization must be displayed in the shared memory model, such as synchronized, and synchronization is i...

Java multi thread programming core technology (notes)

Multithreading is asynchronous (asynchronous, i.e., synchronized, ReentrantLock, etc.), and the time when the thread is called is random.   There are two ways to use multithreading: inherit Thread and implement the run method under Runnable interface. ThreadThe class implements the Runnable interface, which has polymorphic relationships. A thread is a sub task, and CPU runs in an uncertain way.   Thread.startMethod tells the thread planner that the thread is ready to wait for the run method of the thread object to be called. If the Thread.run method is invoked, it is not executed asynchrono...

P3375 [template] KMP string matching

P3375 【Template] KMP string matching Title Description As the title, give two strings S1 and s2, where S2 is a substring of s1, find out all the positions of S2 in s1. In order to reduce the situation of cheating, next output the prefix array next of the substring. (If you don’t know what that means, don’t ask, go to Baidu and learn about the KMP algorithm. Input output format Input format:   The first behavior is a string, that is S1. Second behavior a string, that is S2   Output format:   A number of rows, each containing an integer, indicating the position of S2 in S1. ...

design_model(13)Iterator

1.Iterative mode Provides a way to access elements in an aggregated object sequentially without exposing the internal representation of the object. 2.Example public interface Iterator { public Boolean hashNext(); public Integer next(); } public class IteratorImp { private ArrayList<Integer> list; public IteratorImp(ArrayList<Integer> list) { super(); this.list = list; } public MyIterator iterator() { return new MyIterator(); } class MyIterator implements Iterator { private int size = list.size(); private int i = 0; @Override publ...