Page 1 of 1

Dev enviroment for OSDev?

Posted: Thu Feb 15, 2007 10:04 pm
by uglyoldbob
Does anybody use any sort of developer software (something like kdevelop, MSVC, whatever) to develop their software?
Right now I just use kedit (it highlights C code nicely), then when I want to compile, I save all source files that I have changed, then execute my compiling script (makefile is soooo slow). My scriptfile calls bochs at the end.

Posted: Thu Feb 15, 2007 10:37 pm
by iammisc
i use gedit, a terminal, and makefiles. How is a bash script faster than a makefile? You probably haven't written the makefile right because compiling only what changed should be faster than just re-compiling everything at least it is with my os.

Posted: Thu Feb 15, 2007 11:26 pm
by Solar
Check out my Makefile tutorial in the Wiki. I am quite confident that it will embarass the heck out of any non-trivial build script (and perhaps even some trivial ones).

As for environment... I like IDE's for user-space application development, but for the "fine print" (kernel / libc work), I usually go for vim/Kate, gcc and make. Should I ever get to the point of having a kernel supporting user-space programs, not relying on a big fat IDE would make it easier to port the toolchain and go self-hosted, too.

Re: Dev enviroment for OSDev?

Posted: Fri Feb 16, 2007 1:18 am
by Brendan
Hi,
uglyoldbob wrote:Does anybody use any sort of developer software (something like kdevelop, MSVC, whatever) to develop their software?
I use KWrite to edit the text/source files (syntax highlighting) and a hierarchy of build scripts where the top level script starts scripts in each sub-directory (which start scripts in their sub-directories, etc). As part of this my own "build utility" is compiled (if necessary), and either make or my build utility is used within the other scripts to build each "part".

The build process creates binaries, disassembles, does hex dumps, finds debugging markers, auto-generates HTML pages, and creates a "tar.gz" package (ready to upload to my web host).

The top level build script is assigned to F12 as a keyboard shortcut (in KDE), so I can modify any of the files and press F12 to update everything. Emulators are assigned to other function keys - for e.g. "Bochs 80486" is assigned to F5, "Bochs Pentium" is assigned to F6, Qemu is assigned to F9, etc. I also use shift&F12 to view the Bochs log.

I also have some real machines here setup for network boot (which my OS supports). The build script copies any files into the TFTP directory ready for this, so I only need to press F12 then turn a machine on to see how my OS crashes.. :)

I test my OS very frequently though - rather than writing something completely and then testing it completely, I'll write a little bit, test a little bit, write some more, test some more, etc (even if it's just code to display some results).

I remember back when my "write, build, test" cycle involved notepad, batch files and floppy disks, where I'd create a boot floppy every time I needed to test something - it's like trying to drive a car with the hand-brake on. Anything that makes your "write, build, test" cycle faster is worth investigating... ;)


Cheers,

Brendan

Posted: Fri Feb 16, 2007 3:33 am
by jhawthorn
As iammisc and Solar have stated, if your Makefile is worse than a bash script you're doing something silly.

I've been using SCons as my build environment lately. It has some really nice features (md5sums rather than timestamps, repositories, less silly recursion) and it gives one that nice "I used something overly elegant in python to solve a simple problem" feeling.

Posted: Fri Feb 16, 2007 3:39 am
by Combuster
Tried searching?
Thread: What IDE and compiler do you use?

Posted: Fri Feb 16, 2007 7:39 pm
by bewing
I agree with Dex on the other thread -- I'm intending to create and port a tiny minimal IDE to my OS ASAP -- as one of the 1st things I get running.

Posted: Sat Feb 17, 2007 10:21 am
by Dex
You can start with a simple text file viewer, DexOS IDE started from a text file viewer by tony(mac),a founding member of DexOS .

Code: Select all

;=========================================================;
; View  0.1                                      01/01/05 ;
;---------------------------------------------------------;
; A simple text viewer(by tonyMac).                       ;
;                                                         ;
; DexOS V0.01                                             ;
; (c) Craig Bamford, All rights reserved.                 ;
;=========================================================;

;end_of_prog =   0x200000

;----------------------------------------;
;                Includes                ;
;----------------------------------------;

include 'macros.inc'

;----------------------------------------;
;             Program  Entry             ;
;----------------------------------------;
ViewText:
               pushad

               mov      ax, 18h
               mov      ds, ax
               mov      es, ax

               mov      al, 0x09
               call     TextColor

	       mov      esi, FirstMessage
	       mov	al, 00h
	       mov	ah, 09h
	       int	40h

	       xor	al, al
               mov	ah, 02h
               int	40h
	     

               mov	ebx, dword[ImageLoadAddrVar]     ;get where the file is memory
	       mov	eax, out_buffer       ;put it in 2nd counter
	       xor	ecx, ecx	      ;0 line position
	       xor	edi, edi
process:

	       mov	dl, [ebx]	      ;get char
	       cmp	dl, 09h 	      ; is it tab?
	       je	new_tabber
	       cmp	dl, 0Ah 	      ; is it linefeed?
	       je	println
	       cmp	dl, 0Dh 	      ; is it cariage return?
	       je	println 	      ; print the line
	       cmp	dl, 1Ah 	      ; is it end of file?
	       je	end_of_file
	       cmp	dl, 00h 	      ; is it null?
	       je	end_of_file
	       mov	[eax], dl	      ;if not, stick in buffer
	       cmp	eax, out_buffer + 80  ;check buffer, full?
	       jae	println 	      ;yeah, print the buffer
	       inc	eax		      ;else next buffer offset
	       inc	ebx		      ;next  char
	       inc	ecx		      ;scrn pos inc
	       jmp	process 	      ;loop

nothing:
	       inc	ebx
	       jmp	process
new_tabber:

	       mov	esi, ecx	      ; save the eax
	       and	cl, 7		      ; get the desired area
	       cmp	cl, 0		      ; chk for 0
	       jz	simp_tab	      ; if 0 simple  tab
	@@:    inc	esi		      ; incrememt esi
	       inc	eax		      ; increment eax
	       mov	ecx, esi	      ; reload ecx
	       and	cl, 7		      ; get desired area
	       cmp	cl, 0		      ; check if 0
	       jz	@f		      ; if yeah keep spot
	       jmp	@b		      ; if not, another round
	@@:
	       mov	ecx, esi
	       inc	ebx

	       jmp	process
      simp_tab:
	       mov	ecx, esi
	       add	eax, 8
	       add	ecx, 8
	       inc	ebx
	       jmp	process
end_of_file:
              ; mov	[eax], dl
	       mov	byte [eax], 0	      ;check for null
	       print	out_buffer	      ;empty buffer
	       xor	eax, eax	      ;0 counters
	       xor	ebx, ebx	      ;
	       xor	ecx, ecx
	       waitkey			      ;wait for keypress
               popad
	       ret			      ;end of prog.

println:
		cmp	dl, 0dh 	      ; is it <cr>?
		jnz	@f		      ; if not, continue
		inc	ebx		      ; else get next char
		cmp	byte [ebx], 0ah       ; is it <lf>?
		jz	@f		      ; if so coninue on 1 return
		dec	ebx		      ; else reinstate old pointer
	 @@:
		mov	byte [eax], 13
		inc	eax
		mov	byte [eax], 0	      ;stick in the null char
		print	out_buffer	      ;print it
		mov	eax, out_buffer       ;put address in eax
		mov	ecx, 80
	 @@:
		mov	byte [eax], ' '       ;make buffer spaces
		inc	eax
		dec	ecx
		jnz	@b
		mov	eax, out_buffer       ;reset eax to buffer 0
		inc	ebx		      ;tell next char
		xor	ecx,ecx 	      ;0 the screen index
		inc	edi
		cmp	edi, 40 	      ;is bottom of screen?
		jnz	process 	      ;if not, keep going
		push	eax		      ;save eax
		print	message 	      ;any key to cont.
		xor	al,al
                mov	ah, 02h
                int	40h
		xor	edi, edi
                cmp     al,0x1b
                je      TextViewExit
		pop	eax
		jmp	process 	      ;loop

TextViewExit:
                pop     eax
                popad
                ret

;----------------------------------------;
;               Data  Area               ;
;----------------------------------------;

FirstMessage  db 0xd2,0x02, 'Text viewer, by tonyMac.',13
              db 0xd2,0x09,'Press any key to view text file',13,0

message       db 13,'Press a key',13,13,0

out_buffer:
	times 90 db ' '
		  dd 0
macros.inc here:

Code: Select all

;=====================================;
;Simple macros to sort of HLA the     ;
;programming of more complex apps so  ;
;as to keep the source uncluttered.   ;
;-------------------------------------;
;tonyMac                        2005  ;
;=====================================;


;-------------------------------------;
;Print                                ;
;-------------------------------------;
;                                     ;
;This prints a 0-terminated string.   ;
;Suprising, huh?   ;-)                ;
;-------------------------------------;

macro print string
{
	push	esi
	mov	esi, string
	mov	al, 00h
	mov	ah, 09h
	int	40h
	pop	esi
}


;-------------------------------------;
;waitkey                              ;
;-------------------------------------;
;                                     ;
;wait for keypress                    ;
;-------------------------------------;
macro waitkey
{
xor	al,al
mov	ah, 02h
int	40h
}
NOTE: This was written to be called from CLI.