I want to write my own custom code for Simulation in NetSim of www.tetcos.com.
I am a newbie to NetSim and can anyone explain me how to create new project ? Or just how do I printf to NetSim console ? Like a basic hello world type project ?
Here are three simple steps on how to start customization of code:
Step 1: Set up your project: Set your compiler such that your project code compiles into a Dynamic Link Library (DLL) in win (or Dynamic Shared Library (.so) in Linux).
Step 2: Copy source code: NetSim’s installation directory contains the source code for all protocols in folder $(NETSIM_INSTALL_DIR)/NetSim/Simulation/src . Copy paste the following files:
a. Header files related to TCP from the path $(NETSIM_INSTALL_DIR)/src/simulation/include
b. Lib files related to TCP from the path $(NETSIM_INSTALL_DIR)/src/simulation/lib
c. Source files related to TCP from the path $(NETSIM_INSTALL_DIR)/src/Simulation/tcp
Step 3: Modify code and replace the binary: Open TCP.c and write the Hello World print statement just after the TCP init function. Then build your code and replace the existing binary of NetSim (libTCP.dll or libTCP.so(for linux) in $(NETSIM_INSTALL_DIR)/NetSim/Simulation/bin) with your libTCP.dll(or libTCP.so).
Next, run a simulation you would see "Hello World" in command line.
Related
I want to create a simple library and after compilation and ar command I can get resulting .a file.
Now I want to add this file as a static library and use it in terminal, I dont know if its possible. but idea is from other library named Ctypes.sh on github. that library can be used to make syscalls from terminal or bash terminal.
I like to know how I can add my mylib.a as static libary and make it usable from terminal.
the library is simple I just want to invoke a few syscalls in linux from terminal.
I also looked into the code of ctypes.sh so my library is also be used to make some syscalls.
the reference I used above is here
https://github.com/taviso/ctypes.sh/wiki
Every command that you run on linux are binary file that you execute.
When you run a command like:
ls -a
it's like running:
./ls -a
Where the ./ls is the binary and -a a parameter.
All the binary used in a terminale is stocked in the bin (included in the default PATH). When you run a command your terminal will check in first, in the folder to find the binary and after, he gonna check every folder in the PATH environement variable. If you wan't to add a specific folder to the PATH to use a personnal folder for different baniry (check this link).
In your probleme you have a library with different function (I suppose) that you wan't to use in a terminale. Have 2 solution:
Split your library in multiple micro programme, that you can execute in the terminale,
Create a programme whit param to run different function.
I have programmed a simple module that can be loaded into the kernel to control a simple led. It works fine.
The source files are two C files and one header file:
gpio_handler_ws.c nct5104d_access.c nct5104d_access.h
I decided to add it to kernel sources doing these steps:
1. In drivers/char modify the Kconfig file adding:
config GPIO0_DEVICE
tristate "GPIO0 device"
default y
help
"Creates /dev/wsgpio0 char device to control GPIO0"
2. In drivers/char modify the Makefile file adding:
obj-$(CONFIG_GPIO0_DEVICE) += wsgpio_udev.o
wsgpio_udev-objs := gpio_handler_ws.o nct5104d_access.o
3. Copy source and headers files to drivers/char directory
Then, if I select the m option in menuconfig to compile it as a module, it creates the wsgpio_udev.ko file that works as expected, I can load it and it creates de /dev/wsgpio0 device that controls the LED.
BUT if I select the built-in option it compiles and generates the wsgpio_udev.o file but after rebooting with the new kernel no /dev/wsgpio0 device is created. As far as I know, the built-in modules are listed in /lib/modules/$(uname -r)/modules.builtin but I don't see wsgpio_udev.ko there
Am I missing something?
Please please help me, I am a computer illiterate female looking to convert a group of (.cng files) into jpegs. I found a source code on a blog that instructs me to
Build it, then run it with something like this:
cng2jpg /path/to/images/199x/1990101/*.cng
Here is a link to the source code
Does anyone know how I can run the source code to convert the files?
Here is a link to the blog post for reference for what exactly I am doing
First, put the source code into a file named cng2jpg.c. Then open a terminal, navigate with cd into the directory where you placed that file and type
cc -o cng2jpg cng2jpg.c
This creates the program cng2jpg. You can execute it by typing
path/to/cng2jpg input_file.cng
where path/to/cng2jpg is the path where cng2jpg was generated in the previous step.
I am creating a library, which require some assembly level code.
I am using using NASM to write and integrate my .asm file.
Now the problem is, I already have a project created in VS13. Now I want to add and integrate an assembly level code to my project.
I have already added a .asm file in my source directory, but when I am trying to run my test case, the compiler is unable to find my assembly code.
I want to know how can I link my .asm file with my .c file.
Structure of my project:
->Project1(Generates a Library)
--->Source
----->File1.c
----->File2.c
----->nasm.asm
->Project2 (Test case to use the library and generate .exe)
-->Source
---->main.c
Now, nasm.asm binaries should get attached with the .lib generated by project1
and Project2 should able to access project1.lib
Apologize if question is bit unclear, its a bit complex for me to make it clear in written. Please let me know if you want any clarification or extra information.
Thanks a lot
For each of you assembly files:
Right click it in the Solution Explorer and choose Properties
Make sure the selected Configuration is either All Configurations or the configuration you are using (this bites me every time!)
In the Configuration Properties>General change the Item type to Custom Build Tool
From the Configuration Properties>Custom Build Tool>General set the following items:
Command Line. Use this as an example: nasm -fwin32 "%(FullPath)" -o %(Filename).obj
Outputs. This is necessary, VS check for this files. I usually use %(Filename).obj.
Link Objects. Yes. If you name your output files with obj extension they are automatically included in the link phase.
To check that you set everything right, select your assembly file, right click and choose Compile.
I am working in a UEFI environment and working with C code. To run a simple UEFI command I have to do it through C as shown below:
swprintf(
run_cmd,
wcslen(L"idrac1:\\Tools\\TCP_Recieve.efi")+wcslen(ipAddress)+1,
L"idrac1:\\Tools\\TCP_Recieve.efi %ls",
ipAddress
);
I need to know how to print the contents of the Pen Drive which is connected to my server using C code. I need something similar to 'ls' or 'dir' but for UEFI. Please help me with this.
The UEFI Shell source is available, which contains the source code for the ls command. It should give you enough information for what you need.
Download The EDKII UEFI Shell source.
Locate \ShellPkg\Library\UefiShellLevel2CommandsLib\Ls.c.