bloggerads

2021年7月24日 星期六

Scatter File Note

用來描述source code裡面, 變數, 程式要放到memory的哪一段位址.
然後一些defin, source code 和 scatter file會互相參考

常見的簡單 scatter file內容:

1.

https://developer.arm.com/documentation/dui0493/i/Chdbjdii


execution region的起始位置設為load region的起始位置

 2.

LOAD ADDR SIZE ;ADDR: 起始位址, SIZE: 長度
{
    RO +0
    {
        * (+RO)
    }

    RW +0 ;跟在前一個區域後面接著放
    {
        * (+RW)
    }

    ZI +0
    {
        * (+ZI)
    }
}

2021年7月19日 星期一

Windows平台用cygwin安裝build code工具make

1. Download cygwin
https://www.cygwin.com/
2. Execute the exe:
When you get to the "Select Packages" screen, expand the "Devel" section, find the "make" package, and select the version you want
3. Add make path to the environment. (typically under cygwin64/bin)
4. Done.

2021年7月14日 星期三

2021年7月6日 星期二

ARM 打包 library的command

打包成.a的形式:   armar   -r  mylib.a   obj1   obj2   obj3

打包成.lib的形式: armar   --create   mylib.lib   obj1   obj2 

.a或.lib可以直接和其他.o檔一起link, 產生出最後的binary

Visual Studio Hotkey/Operation (Continue Update..)

Duplicate this line: Alt + Shift + ↓

Comment/Uncomment line(s): Ctrl + /

Search Function: Ctrl + t

Bookmark: Ctrl + Alt + k

Jump to Bookmark: Ctrl + Alt + j

Trim trailing space automatically:

Transform TAB to Space

Show the function list in a file



2021年6月29日 星期二

Add a Git Submodule

Use Git Turtoise:

TortoiseGit -> Submodule Add...

Use Git Command:

git submodule add -b <branch> --name <submodule name> <repository> <folder path>

----------------------------------------------------------------------------------------------

After setting the previous step, you will find the new file ".gitmodules" is created (or updated)
Check the contents if it is as expect:

[submodule "name"]

path <folder path>

url =  <repository>

branch <branch>  -->  One of branch in the Submodule repository (Can ignore this one)

----------------------------------------------------------------------------------------------

Following Issue happened in build code after I add the submodule in my one of project:

cp: cannot overwrite directory 'xxxxxxxx.git' with non-directory

This means the build procedure is trying to copy xxxxxxxx.git to somewhere the xxxxxxxx.git has already existed.

I did the following steps to overcome this problem. (or you can simply delete it, and it will be automatically generated during submodule init)

1. git commit/check-in the code 
2. delete the xxxxxxxx.git in the submodule 
3. git submodule init/update



2021年6月26日 星期六

Arm Memory Structure Note

Observe the .lst file (generated by ARM compiler) to get the following conclustion.
ARM memory map is consists of:
  1. .Code
  2. .RO
  3. .RW
  4. .ZI
.Code = Code + inline Data
.RO = Constant Data
.RW = Local Variable
.ZI = Global Variable (Include Static Variable)

Add any code that may possibly increase RAM or ROM size.

ROM size = .Code + .RO + .RW 
RAM size = .RW + .ZI

The actual ARM outputted binary size is ROM size

<NOTE>
What makes .RW so special is because .RW data stays in the ROM but during initializing, it will be copied to RAM

C/C++ in Arm Cross Compiler

in Arm, C++ compiler recognizes keyword: extern "C", and the Macro __cplusplus

In C header files, add __cplusplus to make sure the header files can be recognized by C++, as following

#ifdef  __cplusplus // This statement is true in C++ but false in C
extern "C"
{
#endif

//Original Header File Contents

#ifdef __cplusplus
}
#endif

In C++, 

If you'd like to include a C header file without changing the C header, you can do like:

extern "C"{
     #include "CHeader.h"
}

If you'd like to export a function to C, you can do like:

extern "C" int OutputApi(int);



<NOTE>
A header file can only be compiled one time.
So it is needed to add a pure C type header file additionally to designate what C++ exported functions.
This C type header file is actually included in other C source files. (not in C++)
Following are the workable method to achieve the C/C++ cross compiler in ARM.

a.cpp
void aa(void){}

a.h
#ifdef  __cplusplus
#define EXTERN_C extern "C"
#else
#define EXTERN_C
#endif
EXTERN_C  void aa(void);

intermediate.h
include <a.h>

b.c
include <intermediate.h>
void call_c()
{
    aa();
}

2021年2月24日 星期三

Plant UML Example


PlantText UML Editor: https://www.planttext.com/

Flow Chart
@startuml
(*) --> "A example of a step"
    if "Is This is a good example?" then
        --> [Yes] "Copy it"
        -->(*)
    else
        --> [No] "Drop it!"
        -->(*)
    endif
@enduml


@startuml
participant User
 
User -> A1
activate A

-> B2
activate B

-> C3
activate C

C --> B: end3
destroy C

B --> A: end2
deactivate B

-> User: end1
deactivate A
 
@enduml



@startuml
A : A's property
B : B's property
C : C's property
[*] --> A : start to A
[*] --> B : start to B
A --> B : A to B
B --> C : B to C
C --> B : C to B
C --> C : C to C
@enduml

2024/05/21
Set arrow color & set contents color
skinparam arrowColor #blue
AAA-->BBB:  <color:blue> Description
AAA-[#red]->BBB:  Description