I worked with NVME device recently. To challenge the firmware, NVME command has to be sent from host. I can choose to use LeCoy's software and hardware box to send command,, another way is to use a plain PC with linux installed.
The test framework is 3-layers architecture, the device driver (dnvme) at bottom, dynamic link library in the middle to provides APIs, and test scripts (perl or python) on top. Here is available open source resources
NVMe Compliance Test
https://github.com/nvmecompliance/tnvme
Linux driver for NVMe Compliance Suite
https://github.com/nvmecompliance/dnvme
Linux NVME command interface
https://github.com/linux-nvme/nvme-cli
NVME windows command issuer
https://github.com/Miyavi-Chen/NVMe_CMD_issuer
prettify
Feb 4, 2016
memcpy for ARMv7
There is lot of ways to implement memcpy(), the most efficient way is of course the DMA, although it has overhead to setup the DMA descriptor. Armcc compiler just do it in a simple way
;r0 stores the destine and r1 stores the source
LDM r1!,{r3,r4,r12,lr}
STM r0!,{r3,r4,r12,lr}
Each 2 machine cycle copies 16 bytes of data. I ignored extra codes to handle non-16-bytes-aligned data.
;r0 stores the destine and r1 stores the source
LDM r1!,{r3,r4,r12,lr}
STM r0!,{r3,r4,r12,lr}
Each 2 machine cycle copies 16 bytes of data. I ignored extra codes to handle non-16-bytes-aligned data.
Jan 29, 2016
mutex in armv8
Finally I am working on armv8 soc now. At the very beginning I need a mutex, which is essential for multiple core processors. The old strex/lderx on longer available, now we have ldxr/stxr instead
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dht0008a/ch01s03s02.html
get_lock PROC
mov w1, #0x1
try_loop
ldaxr w2, [x0]
cbnz w2, try_loop
stxr w2, w1, [x0]
cbnz w2, try_loop
ret
ENDP
free_lock PROC
mov w1, #0x0
stlr w1, [x0]
ret
ENDP
try_lock PROC
mov w1, #0x1
ldaxr w2, [x0]
cbnz w2, exit
stxr w2, w1, [x0]
exit
mov w0, w2
ret
ENDP
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dht0008a/ch01s03s02.html
get_lock PROC
mov w1, #0x1
try_loop
ldaxr w2, [x0]
cbnz w2, try_loop
stxr w2, w1, [x0]
cbnz w2, try_loop
ret
ENDP
free_lock PROC
mov w1, #0x0
stlr w1, [x0]
ret
ENDP
try_lock PROC
mov w1, #0x1
ldaxr w2, [x0]
cbnz w2, exit
stxr w2, w1, [x0]
exit
mov w0, w2
ret
ENDP
Jan 28, 2016
C++ string::split
I can understand the reason why C does not provide the string split function, but C++ is another story. A guy told me today C++ is going to add an split function, but not in C++11. It is been so late. I always have to write something like this
that's too much job from Java's split, no mention the powerful regex based split in Perl.
#include <sstream>
#include <vector>
std::vector<std::string> split(const std::string& s, const char delim){
std::vector<std::string> res;
std::string item;
std:stringstream ss(s);
while(std::getline(ss, item, delim)) {
if(!item.empty()) res.push_back(item);
}
return res;
}
that's too much job from Java's split, no mention the powerful regex based split in Perl.
Assembly conditional compile for armcc
I have a bare metal code based which runs good on ARM Cortex-A7. Now I want run the same code on ARM Cortex-R5 without major change of the code, and keep the 2 projects share the same code base by compiling options. It is easy to identify the target by defining pre-processor marcos in make file and use #ifdef for C language.
It has the similar thing for armcc. Just define flags for ARM assembler like this
--predefine "CORTEX5 SETA 1"
This option defines a marco CORTEXR5, and assign value 1 to it, In the assembly I can easily use (make sure you have tab before IF/ELSE/ENDIF)
IF CORTEXR5 == 1
nop
ELSE ;Cortex-A7
smc #0
ENDIF
An alternative way is to define the marco in assembly source file
GBLA CORTEXR5
CORTEXR5 SETA 1
I prefer the previous one since it is easier to manage thru makefile or DS-5's build configuration.
It has the similar thing for armcc. Just define flags for ARM assembler like this
--predefine "CORTEX5 SETA 1"
This option defines a marco CORTEXR5, and assign value 1 to it, In the assembly I can easily use (make sure you have tab before IF/ELSE/ENDIF)
IF CORTEXR5 == 1
nop
ELSE ;Cortex-A7
smc #0
ENDIF
An alternative way is to define the marco in assembly source file
GBLA CORTEXR5
CORTEXR5 SETA 1
I prefer the previous one since it is easier to manage thru makefile or DS-5's build configuration.
Dec 7, 2015
DS-5 script disable memory verification
It is not a surprise some bits of a registers of a SOC are read-only. That means you can not change the value of the bits, thus a writing operation won't change the value. However, DStream always check the value and thus make it annoying to do batch update of registers. Here is on way to disabled it in DS-5 script
stop
wait 1s
show architecture
show version
info core
memory 0x00000000A0000000 +0x30000000 nocache noverify nobp nohbp
memory set 0x00000000A0014008 32 0x00404500
memory set 0x00000000A0002000 32 0x00010000
stop
wait 1s
show architecture
show version
info core
memory 0x00000000A0000000 +0x30000000 nocache noverify nobp nohbp
memory set 0x00000000A0014008 32 0x00404500
memory set 0x00000000A0002000 32 0x00010000
Oct 26, 2015
Upgraded to DS-5 5.22
Finally I upgraded to DS-5 5.22 since I need the ARM v8 support. There are 2 pitfalls during the upgrade.
1. Eclipse asked me to upgrade my DS-5's firmware. Well, embarrassingly, the FW upgrade utility can not find ANY DS-box in my network. There was at least 3 boxes in the same ethernet segment though. I have to hooked up the USB cable to download the firmware.
2. To connect to the board, there is no longer need to detect and save the board configuration file then import it with "cdbimport". Now you may just type "platform configuration" in the "Quick Access" box in eclipse and you will be able to identify the chip from DS-5. Supper cool, this function should be included earlier.
I also installed 5.22 on a Ubuntu14/64bits machine. The installation was smooth, the installation just missed to create desktop shortcut for me, but I can run /opt/local/bin/DS5-5-22/bin/eclipse directly.
1. Eclipse asked me to upgrade my DS-5's firmware. Well, embarrassingly, the FW upgrade utility can not find ANY DS-box in my network. There was at least 3 boxes in the same ethernet segment though. I have to hooked up the USB cable to download the firmware.
2. To connect to the board, there is no longer need to detect and save the board configuration file then import it with "cdbimport". Now you may just type "platform configuration" in the "Quick Access" box in eclipse and you will be able to identify the chip from DS-5. Supper cool, this function should be included earlier.
I also installed 5.22 on a Ubuntu14/64bits machine. The installation was smooth, the installation just missed to create desktop shortcut for me, but I can run /opt/local/bin/DS5-5-22/bin/eclipse directly.
Subscribe to:
Posts (Atom)