I've been trying to get this code working for quite some time now. Is there anyone that can explain to me why the buffer stays empty after the syscall. The .txt file, the .asm file and the mars.jar are all in the same directory. I've tried specifying a full path to the file but that didn't work either.
.data
fin: .asciiz "input.txt"
.align 2
buffer: .space 2048
.text
# Open file
li $v0, 13 # System call for opening files
la $a0, fin # load file name adress in $a0
li $a1, 0 # Open for writing
li $a2, 0 # mode is ignored
syscall # open a file (file descriptor returned in $v0)
move $s3, $v0 # save file descriptor to $s3
# Read from file to buffer
li $v0, 14 # system call for read from file
move $a0, $s3 # file descriptor
la $a1, buffer # address of buffer to which to load the contents
li $a2, 2048 # hardcoded max number of characters
syscall # read file
# Close file
li $v0, 16 # system call for close file
move $a0, $s3 # file descriptor to close
syscall # close file
I've found the solution. You have to specify the full path from root to file to get it to work. Hope this helps someone else in the future.
Related
According to the info in generated dtb, the memory-mapped registers of gicv3-distributor have a base addr, which is 0x0800_0000.
And I have checked the validity by reading gicd_typer, which means the base addr is right.
But when I want to configure the gicv3-distributor (like changing GICD_ICACTIVER<n>), the value is not changed, keeping the default value. The same thing happens on any register of GICD in my machine.
I change them with assembly code as soon as the machine starts, not enable MMU.
ldr x8, =0x8000380
ldr x9, =0xffffffff
str x9, [x8]
dsb sy
ldr x0, [x8]
(gdb) i r x0
x0 0x0 0
Even I write to this memory by gdb set command, the value is also unchangeable.
The addr of GICD_ICACTIVER<n> should be 0x0800_0380(offset=0x380), which should be readable and writable, isn't it?
The UART(pl011)-related address(0x0900_0000) can be written normally.
Host machine: Ubuntu 18.04
qemu version: 7.1.50 (v7.1.0-256-g79dfa177)
Target OS: bare-metal
qemu command:
./qemu-system-aarch64 -machine virt,gic-version=3,secure=on,virtualization=on -cpu cortex-a76 -m 1G
The GICD_ICACTIVER register bits are write-1-to-clear, so if you write all-1s to the register then you should expect it to read back as all-0s.
More generally, not all hardware device registers will read back the same value that you write to them -- it depends entirely on the device.
I Have Mysql server 5.5.42 Installed Files, I have successfully Configured & Created Mysql Services, Its Working Good.
My Question is When Im Configuring Mysql Using Innosetup, The Data Folder is Automatically Assigned as in C:\Program Files (x86)\HiMySQL\data but i need to change this Directory to C:\ProgramData\HiMySQL\data
Here is My Code for configuration.
Filename: {pf32}\HiMySQL\bin\MySQLInstanceConfig.exe; Parameters:"-i -q ""-l{pf32}\HiMySQL\mysql_install_log.txt""""-nMySQL Server 5.5"" ""-p{pf32}\HiMySQL\"" -v5.5.23 ""-t{pf32}\HiMySQL\my-template.ini"" ""-c{pf32}\HiMySQL\my.ini"" ServerType=SERVER DatabaseType=MIXED Port=3344 StrictMode=yes ConnectionCount=15 Charset=utf8 ServiceName=HIMySQL AddBinToPath=yes RootPassword=myserver";WorkingDir: {pf32}\HiMySQL\bin\; StatusMsg: Configuring MySQL services; Description: Configuring MySQL Service; Flags: runhidden
Filename: net.exe;Parameters: start HIMySQL;StatusMsg: Starting MySQL Server;Flags: runhidden
Please Help Me Out To Resolve this issue.
my-template.ini file code
# MySQL Server Instance Configuration File
# ----------------------------------------------------------------------
# Generated by the MySQL Server Instance Configuration Wizard
#
#
# Installation Instructions
# ----------------------------------------------------------------------
#
# On Linux you can copy this file to /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options
# (#localstatedir# for this installation) or to
# ~/.my.cnf to set user-specific options.
#
# On Windows you should keep this file in the installation directory
# of your server (e.g. C:\Program Files\MySQL\MySQL Server X.Y). To
# make sure the server reads the config file use the startup option
# "--defaults-file".
#
# To run run the server from the command line, execute this in a
# command line shell, e.g.
# mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# To install the server as a Windows service manually, execute this in a
# command line shell, e.g.
# mysqld --install MySQLXY --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# And then execute this in a command line shell to start the server, e.g.
# net start MySQLXY
#
#
# Guildlines for editing this file
# ----------------------------------------------------------------------
#
# In this file, you can use all long options that the program supports.
# If you want to know the options a program supports, start the program
# with the "--help" option.
#
# More detailed information about the individual options can also be
# found in the manual.
#
#
# CLIENT SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
#
[client]
port=3339
[mysql]
default-character-set=latin1
# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this
# file.
#
[mysqld]
# The TCP/IP Port the MySQL Server will listen on
port=3339
#Path to installation directory. All paths are usually resolved relative to this.
basedir="C:/Program Files (x86)/MYSQLHI"
#Path to the database root
datadir="C:/ProgramData/MYSQLHI/Data/"
# The default character set that will be used when a new schema or table is
# created and no character set is defined
character-set-server=latin1
# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB
# Set the SQL mode to strict
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
# The maximum amount of concurrent sessions the MySQL server will
# allow. One of these connections will be reserved for a user with
# SUPER privileges to allow the administrator to login even if the
# connection limit has been reached.
max_connections=100
# Query cache is used to cache SELECT results and later return them
# without actual executing the same query once again. Having the query
# cache enabled may result in significant speed improvements, if your
# have a lot of identical queries and rarely changing tables. See the
# "Qcache_lowmem_prunes" status variable to check if the current value
# is high enough for your load.
# Note: In case your tables change very often or if your queries are
# textually different every time, the query cache may result in a
# slowdown instead of a performance improvement.
query_cache_size=0
# The number of open tables for all threads. Increasing this value
# increases the number of file descriptors that mysqld requires.
# Therefore you have to make sure to set the amount of open files
# allowed to at least 4096 in the variable "open-files-limit" in
# section [mysqld_safe]
table_cache=256
# Maximum size for internal (in-memory) temporary tables. If a table
# grows larger than this value, it is automatically converted to disk
# based table This limitation is for a single table. There can be many
# of them.
tmp_table_size=17M
# How many threads we should keep in a cache for reuse. When a client
# disconnects, the client's threads are put in the cache if there aren't
# more than thread_cache_size threads from before. This greatly reduces
# the amount of thread creations needed if you have a lot of new
# connections. (Normally this doesn't give a notable performance
# improvement if you have a good thread implementation.)
thread_cache_size=8
#*** MyISAM Specific options
# The maximum size of the temporary file MySQL is allowed to use while
# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.
# If the file-size would be bigger than this, the index will be created
# through the key cache (which is slower).
myisam_max_sort_file_size=100G
# If the temporary file used for fast index creation would be bigger
# than using the key cache by the amount specified here, then prefer the
# key cache method. This is mainly used to force long character keys in
# large tables to use the slower key cache method to create the index.
myisam_sort_buffer_size=33M
# Size of the Key Buffer, used to cache index blocks for MyISAM tables.
# Do not set it larger than 30% of your available memory, as some memory
# is also required by the OS to cache rows. Even if you're not using
# MyISAM tables, you should still set it to 8-64M as it will also be
# used for internal temporary disk tables.
key_buffer_size=24M
# Size of the buffer used for doing full table scans of MyISAM tables.
# Allocated per thread, if a full scan is needed.
read_buffer_size=64K
read_rnd_buffer_size=256K
# This buffer is allocated when MySQL needs to rebuild the index in
# REPAIR, OPTIMZE, ALTER table statements as well as in LOAD DATA INFILE
# into an empty table. It is allocated per thread so be careful with
# large settings.
sort_buffer_size=256K
#*** INNODB Specific options ***
# Use this option if you have a MySQL server with InnoDB support enabled
# but you do not plan to use it. This will save memory and disk space
# and speed up some things.
#skip-innodb
# Additional memory pool that is used by InnoDB to store metadata
# information. If InnoDB requires more memory for this purpose it will
# start to allocate it from the OS. As this is fast enough on most
# recent operating systems, you normally do not need to change this
# value. SHOW INNODB STATUS will display the current amount used.
innodb_additional_mem_pool_size=2M
# If set to 1, InnoDB will flush (fsync) the transaction logs to the
# disk at each commit, which offers full ACID behavior. If you are
# willing to compromise this safety, and you are running small
# transactions, you may set this to 0 or 2 to reduce disk I/O to the
# logs. Value 0 means that the log is only written to the log file and
# the log file flushed to disk approximately once per second. Value 2
# means the log is written to the log file at each commit, but the log
# file is only flushed to disk approximately once per second.
innodb_flush_log_at_trx_commit=1
# The size of the buffer InnoDB uses for buffering log data. As soon as
# it is full, InnoDB will have to flush it to disk. As it is flushed
# once per second anyway, it does not make sense to have it very large
# (even with long transactions).
innodb_log_buffer_size=1M
# InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and
# row data. The bigger you set this the less disk I/O is needed to
# access data in tables. On a dedicated database server you may set this
# parameter up to 80% of the machine physical memory size. Do not set it
# too large, though, because competition of the physical memory may
# cause paging in the operating system. Note that on 32bit systems you
# might be limited to 2-3.5G of user level memory per process, so do not
# set it too high.
innodb_buffer_pool_size=45M
# Size of each log file in a log group. You should set the combined size
# of log files to about 25%-100% of your buffer pool size to avoid
# unneeded buffer pool flush activity on log file overwrite. However,
# note that a larger logfile size will increase the time needed for the
# recovery process.
innodb_log_file_size=23M
# Number of threads allowed inside the InnoDB kernel. The optimal value
# depends highly on the application, hardware as well as the OS
# scheduler properties. A too high value may lead to thread thrashing.
innodb_thread_concurrency=8
Innosetup Script code
; Script generated by the Inno Script Studio Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "HiMySQL"
#define MyAppVersion "1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.example.com/"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{C3323AB2-E5D7-4B94-AF8E-C2E71BD468DE}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DisableDirPage=yes
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputDir=C:\Users\hyva\Desktop\iss
OutputBaseFilename=setup1
Compression=lzma
SolidCompression=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
Source: "C:\Users\hyva\Desktop\m\*"; DestDir: "{pf32}\HiMySQL"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Run]
Filename: {pf32}\HiMySQL\bin\MySQLInstanceConfig.exe; Parameters:"-i -q ""-l{pf32}\HiMySQL\mysql_install_log.txt"" ""-nMySQL Server 5.5"" ""-p{pf32}\HiMySQL\"" -v5.5.23 ""-t{pf32}\HiMySQL\my-template.ini"" ""-c{pf32}\HiMySQL\my.ini"" ServerType=SERVER DatabaseType=MIXED Port=3339 StrictMode=yes ConnectionCount=15 Charset=utf8 ServiceName=MySQL57 AddBinToPath=yes RootPassword=myserver"; WorkingDir: {pf32}\HiMySQL\bin\; StatusMsg: Configuring MySQL services; Description: Configuring MySQL Service; Flags: runhidden
Filename: net.exe;Parameters: start MySQL57;StatusMsg: Starting MySQL Server;Flags: runhidden
Create a template config file with
datadir: "C:/ProgramData/HiMySQL/data"
And pass a path to that file using -t switch to MySQLInstanceConfig.exe.
I am using googlenet model and I want to use a different image size for training (a smaller version of the image) , the image_mean and lmdb files have the reduced size as well . When I modified the size in the googlenet.prototxt and ran the train.sh file the program is being aborted with the following error.
Check failure stack trace: ***
# 0x7fdbb9499daa (unknown)
# 0x7fdbb9499ce4 (unknown)
# 0x7fdbb94996e6 (unknown)
# 0x7fdbb949c687 (unknown)
# 0x7fdbb99543ee caffe::Blob<>::Reshape()
# 0x7fdbb9954619 caffe::Blob<>::Reshape()
# 0x7fdbb98dcc08 caffe::PoolingLayer<>::Reshape()
# 0x7fdbb99968ac caffe::Net<>::Init()
# 0x7fdbb9997725 caffe::Net<>::Net()
# 0x7fdbb985174a caffe::Solver<>::InitTrainNet()
# 0x7fdbb985284c caffe::Solver<>::Init()
# 0x7fdbb9852b7a caffe::Solver<>::Solver()
# 0x7fdbb984a263 caffe::Creator_SGDSolver<>()
# 0x40e67e caffe::SolverRegistry<>::CreateSolver()
# 0x40794b train()
# 0x40590c main
# 0x7fdbb87a7f45 (unknown)
# 0x406041 (unknown)
# (nil) (unknown) Aborted (core dumped)
I have found out that the size for googlenet model is fixed and unique , so modifying it will result in an error. So its mandatory to maintain the same size as required by the model to train.
Upon running ./train_caffenet.sh; creating the layer data, setting up the data, loading the training mean.binaryproto file and opening the training lmdb file all works.
However when it comes to loading the test mean.binaryproto file for the test data I get the following error:
Loading mean file from: /home/pwhc/caffe/Learn/imagenet_mean_test.binaryproto
F0716 13:12:13.917732 3385 db.hpp:109] Check failed: mdb_status == 0 (2 vs. 0) No such file or directory
*** Check failure stack trace: ***
# 0x7f8337946daa (unknown)
# 0x7f8337946ce4 (unknown)
# 0x7f83379466e6 (unknown)
# 0x7f8337949687 (unknown)
# 0x7f8337cbf5be caffe::db::LMDB::Open()
# 0x7f8337d16b82 caffe::DataLayer<>::DataLayerSetUp()
# 0x7f8337d806f9 caffe::BasePrefetchingDataLayer<>::LayerSetUp()
# 0x7f8337ca3db3 caffe::Net<>::Init()
# 0x7f8337ca5b22 caffe::Net<>::Net()
# 0x7f8337cb0a24 caffe::Solver<>::InitTestNets()
# 0x7f8337cb111b caffe::Solver<>::Init()
# 0x7f8337cb12e6 caffe::Solver<>::Solver()
# 0x40c4c0 caffe::GetSolver<>()
# 0x406503 train()
# 0x404ab1 main
# 0x7f8336e58ec5 (unknown)
# 0x40505d (unknown)
# (nil) (unknown)
Aborted (core dumped)
I modified the train_val.prototxt to point the to appropriate mean.binaryproto files (using absolute paths) and have checked and double checked to make sure everything matches.
Any thoughts would be greatly appreciated.
See my answer here:
https://github.com/BVLC/caffe/issues/2780#issuecomment-123385714
Can you post your data layers? It seems like you've switched up data_param.source and transform_param.mean_file.
When you creating new LMDB database from image net, please delete the previous LMDB. This error will come to happen when writing the new image net data for existing LMDB database.
I'm trying to do some access on file using mips instruction.
I want to read file line by line not all of the file at a time so this code(1) does not work.
Also I want to write to the file and not overwrite!
Can any one help me?
Code:
Open a file for writing
li $v0, 13 # system call for open file
la $a0, file # board file name
li $a1, 0 # Open for reading
li $a2, 0
syscall # open a file (file descriptor returned in $v0)
move $s6, $v0 # save the file descriptor
Read from file
li $v0, 14 # system call for read from file
move $a0, $s6 # file descriptor
la $a1, buffer # address of buffer to which to read
li $a2, 40 # hardcoded buffer length
syscall # read from file
Close the file
li $v0, 16 # system call for close file
move $a0, $s6 # file descriptor to close
syscall # close file
I want to read file line by line not all of the file at a time so this code(1) does not work.
Read chunks of data into a buffer (e.g. a few kilobytes). Then process that buffer line-by-line (by looking for linefeed characters), and read more data from the file when you've reached the end of the buffer.
Also I want to write to the file and not overwrite!
Set the flags ($a1) to 9 when opening the file (syscall 13). This corresponds to "write-only with create and append" (see this MARS syscall reference).
it's work thx alot :)
.data
fin: .asciiz "file.txt" # filename for input
buffer: .space 128
buffer1: .asciiz "\n"
val : .space 128
.text
################################################ fileRead:
# Open file for reading
li $v0, 13 # system call for open file
la $a0, fin # input file name
li $a1, 0 # flag for reading
li $a2, 0 # mode is ignored
syscall # open a file
move $s0, $v0 # save the file descriptor
# reading from file just opened
li $v0, 14 # system call for reading from file
move $a0, $s0 # file descriptor
la $a1, buffer # address of buffer from which to read
li $a2, 6 # hardcoded buffer length
syscall # read from file
li $v0, 4 #
la $a0, buffer # buffer contains the values
syscall # print int
lb $t1 , buffer
# reading from file just opened
li $v0, 14 # system call for reading from file
move $a0, $s0 # file descriptor
la $a1, buffer # address of buffer from which to read
li $a2, 6 # hardcoded buffer length
syscall # read from file
li $v0, 4 #
la $a0, buffer # buffer contains the values
syscall # print int
## sh $t5 , val($0) #sw $t5, theArray($t0)
# Close the file
li $v0, 16 # system call for close file
move $a0, $s6 # file descriptor to close
syscall # close file